This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I haven't tried this bugt I don't want to lose thie idea, a self documenting Makefile | |
# https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html | |
# When I try it I'll update this, hopefully. | |
# Basic Syntax | |
target: dependency dependency2 ... | |
command1 | |
command2 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn longest-prefix-at | |
[s i] | |
(let [max-k (. s length)] | |
(or (last (for [j (range 1 max-k) | |
:let [k (+ i j)] | |
:when (<= k max-k) | |
:let [s1 (subs s 0 j) | |
s2 (subs s i k)] | |
:while (= s1 s2)] | |
s2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
APIKEY="From Here https://api.slack.com/custom-integrations/legacy-tokens" | |
SONG=$(osascript -e 'tell application "Spotify" to name of current track as string') | |
URLSONG=$(echo "$SONG" | perl -MURI::Escape -ne 'chomp;print uri_escape($_),"\n"') | |
while true | |
do | |
curl -s -d "payload=$json" "https://slack.com/api/users.profile.set?token="$APIKEY"&profile=%7B%22status_text%22%3A%22"$URLSONG"%22%2C%22status_emoji%22%3A%22%3Amusical_note%3A%22%7D" > /dev/null | |
sleep 60 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require ('./globals')(global); // Mixed in Ramda to global here | |
var Task = require ('data.future'), | |
M = require ('control.monads'), | |
State = require ('fantasy-states'), | |
Reader = require ('fantasy-readers'), | |
Tuple2 = require ('fantasy-tuples').Tuple2, | |
Maybe = require ('data.maybe'), | |
ST = State.StateT (Task), | |
App = Reader.ReaderT (ST); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function pg_temp.rot13( string text ) | |
returns text as $rot13$ | |
begin | |
return translate( string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm' ); | |
end $rot13$ language plpgsql; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is my short-ish tutorial on how to implement closures in | |
a simple functional language: Foo. | |
First, some boilerplate. | |
> {-# LANGUAGE DeriveFunctor, TypeFamilies #-} | |
> import Control.Applicative | |
> import Control.Monad.Gen | |
> import Control.Monad.Writer | |
> import Data.Functor.Foldable |
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# put this in your .bash_profile | |
if [ $ITERM_SESSION_ID ]; then | |
export PROMPT_COMMAND='echo -ne "\033];${PWD##*/}\007"; ':"$PROMPT_COMMAND"; | |
fi | |
# Piece-by-Piece Explanation: | |
# the if condition makes sure we only screw with $PROMPT_COMMAND if we're in an iTerm environment | |
# iTerm happens to give each session a unique $ITERM_SESSION_ID we can use, $ITERM_PROFILE is an option too | |
# the $PROMPT_COMMAND environment variable is executed every time a command is run | |
# see: ss64.com/bash/syntax-prompt.html |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
NewerOlder