Skip to content

Instantly share code, notes, and snippets.

def top_words(n)
words.tally.sort_by(&:last).reverse.map(&:first)[0..n]
end
def words
alice = File.read("alice.txt")
alice.split(/\s+/)
end
def ngram(n)
ability :: Attrs -> Ability
ability attrs =
mkAbility (toSource attrs) 1 (ReactionAbility (AssetDefeated iid))
instance ActionRunner env => HasActions env BrotherXavier where
getActions iid (AssetDefeated iid) (BrotherXavier a) | ownedBy a iid = do
let ability' = (iid, ability a)
unused <- notElem ability' . map unUsedAbility <$> getList ()
pure
[ uncurry ActivateCardAbilityAction ability' | unused ]
import { WebClient, WebAPICallResult, LogLevel } from '@slack/web-api';
import express from 'express';
import fetch from "node-fetch";
import pgPromise from 'pg-promise';
const slack = new WebClient(process.env.SLACK_TOKEN, { logLevel: LogLevel.DEBUG });
var dbu: string
if (process.env.DATABASE_URL !== undefined) {
dbu = process.env.DATABASE_URL
import { WebClient, WebAPICallResult, LogLevel } from '@slack/web-api';
import express from 'express';
import fetch from "node-fetch";
import pgPromise from 'pg-promise';
const slack = new WebClient(process.env.SLACK_TOKEN, { logLevel: LogLevel.DEBUG });
var dbu: string
if (process.env.DATABASE_URL !== undefined)
dbu = process.env.DATABASE_URL
class IncludeTag < Liquid::Tag
VALID_SYNTAX = %r!
([\w-]+)\s*=\s*
(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
!x.freeze
VARIABLE_SYNTAX = %r!
(?<variable>[^{]*(\{\{\s*[\w\-\.]+\s*(\|.*)?\}\}[^\s{}]*)+)
(?<params>.*)
!mx.freeze
reading:
- title: Thief (Ratcatchers, #2)
author: Matthew Colville
url: https://www.goodreads.com/book/show/22236375-thief
- title: The Bear and the Nightingale (Winternight Trilogy, #1)
author: Katherine Arden
url: https://www.goodreads.com/book/show/25489134-the-bear-and-the-nightingale
- title: The Coming of Conan the Cimmerian (Conan the Cimmerian, #1)
author: Robert E. Howard
url: https://www.goodreads.com/book/show/33482.The_Coming_of_Conan_the_Cimmerian
-----BEGIN PGP MESSAGE-----
hQEMA0XM65JUXKTfAQgAmZjxK9O5wsa+8Ys3OVmv0UgPrTS0Uvmpl/epHYCZjX72
F2AeK9myYwy7/TXwRDg2NWsbDILvTWRrrI0mQsbF2jbBh+nPNAd7JKxv/h0RU88X
D3xKAqC5ka6D70MkaYrwfwRQtv5yHUrS4Xq6ESpBx6pvf+xd5w65utcNelQkpGaY
u2S+8MoPCrWnEFl4r42sl7fIis8b42dJ9cNRQIgjEZbp31mlCUN7iQFYk4QVMhX3
jIZE0JkHQtQUaSOT7Ut/S6s11a4h4uU7yqeo1RIvON0T9CmYro+PFq61CnVPe9Iv
etDnYBwn3ccB698OO+OLdDwH0vz6nlYdzW2++3dj4oUBDAPaZmJLmRmopQEH/A4j
rVBlBKrQVE5iWvEl6YHz27yF6r6jjBqDJxC2FfhATeyuLhdb2WwKFeLpiSHr8jRu
yxWlHh2kT9FJQnp+r6kpe7LIdotK16mSiodKMC97BwcWis0GALOqjYLZ6o5TCkuK
support_score,rank,created_at
1,1,2017-03-14 21:12:10.08285+00
1,2,2017-03-14 16:47:08.704764+00
1,3,2017-03-14 08:59:00.558577+00
1,4,2017-03-14 07:48:38.428131+00
1,4,2017-03-14 07:48:38.428131+00
1,6,2017-03-13 14:33:53.110126+00
1,7,2017-03-13 14:21:00.653257+00
1,8,2017-03-13 12:51:15.18242+00
1,8,2017-03-13 12:51:15.18242+00
WITH my_surveys AS (
SELECT
surveys.*,
rank() OVER (ORDER BY surveys.created_at desc)
FROM surveys
JOIN comments
ON comments.ticket_id = surveys.ticket_id
WHERE user_cache IS NOT NULL
AND user_cache->>'email' = '[email protected]'
)
WITH my_surveys AS (
SELECT
surveys.*,
rank() OVER (ORDER BY surveys.created_at desc)
FROM surveys
JOIN comments
ON comments.ticket_id = surveys.ticket_id
WHERE user_cache IS NOT NULL
AND user_cache->>'email' = '[email protected]'
), csat AS (