Skip to content

Instantly share code, notes, and snippets.

@lencioni
lencioni / autocomplete.vim
Created November 17, 2014 17:17
UltiSnips and YouCompleteMe configuration
" YouCompleteMe and UltiSnips compatibility, with the helper of supertab
" (via http://stackoverflow.com/a/22253548/1626737)
let g:SuperTabDefaultCompletionType = '<C-n>'
let g:SuperTabCrMapping = 0
let g:UltiSnipsExpandTrigger = '<tab>'
let g:UltiSnipsJumpForwardTrigger = '<tab>'
let g:UltiSnipsJumpBackwardTrigger = '<s-tab>'
let g:ycm_key_list_select_completion = ['<C-j>', '<C-n>', '<Down>']
let g:ycm_key_list_previous_completion = ['<C-k>', '<C-p>', '<Up>']
# Load/install necessary packages
library(devtools)
#install_github("cpsievert/LDAvis")
library(LDAvis)
library(mallet)
library(Rmpfr)
library(plyr)
library(XML)
library(stringi)
@jhamrick
jhamrick / keep_assigning_hits.py
Created June 11, 2014 04:03
Extend HITs as assignments are completed
#!/usr/bin/env python
"""Extend HITs as assignments are completed.
If a HIT takes up a lot of bandwidth, then you may only want to have a
few workers doing it at a time. This script monitors how many
assignments are currently being worked on, and as they are completed,
extends the HIT with new assignments until a specified upper limit is
reached.
@lyoshenka
lyoshenka / ngrok-selfhosting-setup.md
Last active February 1, 2024 20:14
How to setup Ngrok with a self-signed SSL cert

Intro

The plan is to create a pair of executables (ngrok and ngrokd) that are connected with a self-signed SSL cert. Since the client and server executables are paired, you won't be able to use any other ngrok to connect to this ngrokd, and vice versa.

DNS

Add two DNS records: one for the base domain and one for the wildcard domain. For example, if your base domain is domain.com, you'll need a record for that and for *.domain.com.

Different Operating Systems

@gmccreight
gmccreight / master.vim
Last active June 19, 2024 15:30
A script that gives you a playground for mastering vim
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
@mbostock
mbostock / .block
Last active March 2, 2024 12:15
Arc Tween
license: gpl-3.0
@justincampbell
justincampbell / after.sh
Created March 1, 2013 17:45
Jenkins + GitHub Commit Status API
if [[ $BUILD_STATUS == "success" ]]
then
export STATUS="success"
else
export STATUS="failure"
fi
curl "https://api.github.com/repos/justincampbell/my_repo/statuses/$GIT_COMMIT?access_token=abc123" \
-H "Content-Type: application/json" \
-X POST \
@stephenmckinney
stephenmckinney / zsh_prezto_rbenv_post_rvm.md
Last active December 10, 2015 16:19
Moving from RVM to rbenv with prezto on Mac OS X Mountain Lion

Uninstall RVM

rvm implode

Then remove any reference to RVM in .z* files.

Install rbenv

@jed
jed / rendering_templates_obsolete.md
Created October 19, 2012 05:07
Rendering templates obsolete

(tl;dr DOM builders like [domo][domo] trump HTML templates on the client.)

Like all web developers, I've used a lot of template engines. Like most, I've also written a few of them, some of which even [fit in a tweet][140].

The first open-source code I ever wrote was also one of the the first template engines for node.js, [a port][node-tmpl] of the mother of all JavaScript template engines, [John Resig][jresig]'s [micro-templates][tmpl]. Of course, these days you can't swing a dead cat without hitting a template engine; one in eight packages on npm ([2,220][npm templates] of 16,226 as of 10/19) involve templates.

John's implementation has since evolved and [lives on in Underscore.js][underscore], which means it's the default choice for templating in Backbone.js. And for a while, it's all I would ever use when building a client-side app.

But I can't really see the value in client-side HTML templates anymore.

library(memoise)
library(stringr)
git_prompt <- function() {
git <- find_git()
if (is.null(git)) stop("Git not installed", call. = FALSE)
if (!in_git_repo(git)) stop("Not in git repo", call. = FALSE)
update <- function(...) update_prompt(git)