Skip to content

Instantly share code, notes, and snippets.

@iros
iros / API.md
Created August 22, 2012 14:42
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@sjl
sjl / nextlast.vim
Created September 21, 2012 15:36
next/last text objects
" Next and Last {{{
" Motion for "next/last object". "Last" here means "previous", not "final".
" Unfortunately the "p" motion was already taken for paragraphs.
"
" Next acts on the next object of the given type in the current line, last acts
" on the previous object of the given type in the current line.
"
" Currently only works for (, [, {, b, r, B, ', and ".
"
@holman
holman / cray.md
Created October 15, 2012 19:37
Dropbox is cray

Hi Zach,

We’re working to make it easier for your Dropbox for Teams administrators to manage all the stuff you and your teammates have in your Teams account. Soon, we’ll be releasing new features for admins to manage the security of your team’s stuff and make it easier for them to help when things go wrong.

In some cases, your admin may need the flexibility to take some actions on your Teams account, such as helping to manage shared folders or restoring access if you get locked out of your account. In order to clarify that admins may have access to team member accounts when managing the team, we're updating our Dropbox for Teams Agreement and Privacy Policy.

You might have some personal files in your Teams account that you’d like to move to a personal account. For example, if you want to keep vacation pictures in a different account from your latest Excel spreadsheet, you can use this online guide to move your files:

View the new agreement and get started here

@srid
srid / subcommand.go
Created October 24, 2012 22:52
golang simple subcommand parser
// A simple sub command parser based on the flag package
package subcommand
import (
"flag"
"fmt"
"os"
)
type subCommand interface {
@pearkes
pearkes / gist:4069203
Created November 13, 2012 23:45
My shell prompt, with Vagrant and Git status.
# Example: http://s.jack.ly/iXhJ
prompt() {
PS1="${GREEN}\W\$(parse_git_branch) $BROWN\$(parse_vm_state) ${GREEN}→ ${GREY}"
PS2="\[[33;1m\]continue \[[0m[1m\]> "
}
parse_git_branch() {
@aaronjensen
aaronjensen / edit_data_bag.rb
Created November 21, 2012 04:39
Edit encrypted data bags for use with chef-solo and knife-solo
#!/usr/bin/env ruby
Dir.chdir File.join(__FILE__, "../..")
unless ENV['EDITOR']
puts "No EDITOR found. Try:"
puts "export EDITOR=vim"
exit 1
end
unless ARGV.count == 2
@mwunsch
mwunsch / emoji_image_replace.js
Last active August 13, 2023 21:44
Detect emoji unicode on a page, replace it with images (supplied by GitHub, for now). Goes great in your ~/.js
/**
*
* Here's a thing that will look through all the text nodes of a document, and
* upon encountering an emoji codepoint, will replace it with an image.
* For now, those images are pulled from GitHub, which isn't very nice, so I
* need to find a more suitable host.
*
* Much of this code was gleaned from staring at the minified GitHub JS.
*
* Copyright (c) 2013 Mark Wunsch. Licensed under the MIT License.
@howeyc
howeyc / watchalldirs.go
Created February 12, 2013 12:56
Watch for created directories.
package main
import (
"log"
"os"
"path/filepath"
"github.com/howeyc/fsnotify"
)
@Protonk
Protonk / prng.js
Last active April 7, 2023 09:30
Various PRNGs, implemented in javascript.
// Linear Congruential Generator
// Variant of a Lehman Generator
var lcg = (function() {
// Set to values from http://en.wikipedia.org/wiki/Numerical_Recipes
// m is basically chosen to be large (as it is the max period)
// and for its relationships to a and c
var m = 4294967296,
// a - 1 should be divisible by m's prime factors
a = 1664525,
// c and m should be co-prime
@creationix
creationix / run.js
Last active November 27, 2017 16:06
A tiny generator helper for consuming callback code directly
function run(generator) {
var iterator = generator(resume);
var data = null, yielded = false;
iterator.next();
yielded = true;
check();
function check() {
while (data && yielded) {