View AdventOfCode-Day4.ls
# Day Four in Node for fun
# http://adventofcode.com/2017/day/4/
require! "fs"
require! 'prelude-ls': {lines, words, zip, map, filter, unique}
length = (.length)
sort = (.split('').sort().join(''))
input = map words, lines (fs.read-file-sync "input.txt", 'utf-8')
sorted = map ((x) -> map ((y) -> sort y), x), input
View fb-custom-audiences.js
// FB curl example
// curl \
// -F 'pixel_id=<PIXEL_ID>' \
// -F 'name=My New Website Custom Audience' \
// -F 'subtype=WEBSITE' \
// -F 'retention_days=15' \
// -F 'rule={"url":{"i_contains":"shoes"}}' \
// -F 'prefill=1' \
// -F 'access_token=<ACCESS_TOKEN>' \
// https://graph.facebook.com/v2.7/act_<AD_ACCOUNT_ID>/customaudiences
View Main.hs
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.HashMap.Strict as H
import qualified Data.ByteString.Char8 as C
import Control.Applicative ((<|>))
import Snap.Core
import Snap.Util.FileServe
import Snap.Http.Server (quickHttpServe)
import Snap.Util.GZip (withCompression)
View traverse.js
var traverse = function(o, fn) {
for (var i in o) {
fn.apply(this,[i,o[i]]);
if (o[i] !== null && typeof(o[i])=="object") {
traverse(o[i], fn);
}
}
}
// usage
View export modified files from git
sudo git checkout-index `git diff --name-only SHA1 SHA2` -f --prefix=/directory/
View nyanicon.js
// *** First of all the Favicon.js, Favicon.js - [http://ajaxify.com/run/favicon] ***
var favicon = {
defaultPause: 500,
change: function(iconURL, optionalDocTitle) {
clearTimeout(this.loopTimer);
if (optionalDocTitle) {
document.title = optionalDocTitle;
}
this.addLink(iconURL, true);
},