Skip to content

Instantly share code, notes, and snippets.

@elijahr
elijahr / gist:1051754
Created June 28, 2011 18:08
parse tweets
// based on http://www.simonwhatley.co.uk/parsing-twitter-usernames-hashtags-and-urls-with-javascript
String.prototype.parseTweet = function(){
return this
.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&~\?\/.=]+/g, function(url) {
return url.link(url);
})
.replace(/[@]+[A-Za-z0-9-_]+/g, function(u) {
var username = u.replace("@","")
return u.link("http://twitter.com/"+username);
@elijahr
elijahr / rfr.py
Created August 24, 2011 18:13
A script to aid in refactoring a git-managed codebase
#!/opt/pypy/bin/pypy
# easy project refactoring.
import os
import shutil
from subprocess import Popen
def build_parser():
"""
@elijahr
elijahr / .bash_profile
Created February 2, 2012 17:16
elijahr .bash_profile
#!/bin/bash
#######
# My .bash_profile
#######
export LANG=en_US.UTF-8
parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\ \1/'
@elijahr
elijahr / ssh-copy-id.sh
Created March 19, 2012 16:10
ssh-copy-id.sh
#!/bin/sh
# Shell script to install your public key on a remote machine
# Takes the remote machine name as an argument.
# Obviously, the remote machine must accept password authentication,
# or one of the other keys in your ssh-agent, for this to work.
ID_FILE="${HOME}/.ssh/id_rsa.pub"
if [ "-i" = "$1" ]; then
@elijahr
elijahr / domready.js
Created March 22, 2012 17:10
basic DOM ready handling, sans jQuery
function init(){
// do some stuff to the DOM
}
if (document.addEventListener) {
document.addEventListener('DOMContentLoaded', init, false);
} else {
window.onload = init;
}
@elijahr
elijahr / gist:3132934
Created July 17, 2012 23:37
work on virtualenv
#### automatically activate virtualenvs - from http://toranbillups.com/blog/archive/2012/4/22/Automatically-activate-your-virtualenv
workon_virtualenv() {
if [ -e "${PWD}/pyenv" ]; then
deactivate >/dev/null 2>&1
source "${PWD}/pyenv/bin/activate"
fi
}
virtualenv_cd() {
cd "$@" && workon_virtualenv
@elijahr
elijahr / gist:3165026
Created July 23, 2012 17:59
activate virtualenvs automatically
#### automatically activate virtualenvs named 'pyenv'
#### just put this at the end of your ~/.bashrc file
workon_virtualenv() {
if [ -e "${PWD}/pyenv" ]; then
deactivate >/dev/null 2>&1
source "${PWD}/pyenv/bin/activate"
fi
}
virtualenv_cd() {
@elijahr
elijahr / README.md
Last active July 11, 2024 20:16
Bookmarklet to parse `py.test` failures from a CircleCI build page and generate a command to re-run those tests locally.

parseTestFailures.js

A bookmarklet to parse py.test failures from a CircleCI build page and generate a command to re-run those tests locally.

Installation

Create a bookmark with the following URL:

javascript:(function()%7Bfunction%20requireJQuery(fn)%20%7B%0A%20%20if%20(window.jQuery)%20%7B%0A%20%20%20%20fn()%3B%0A%20%20%7D%20else%20%7B%0A%20%20%20%20console.log(%22No%20jQuery%20available%20yet%2C%20retrying%20in%201s%22)%3B%0A%20%20%20%20if%20(!document.getElementById(%22jquery-script%22))%20%7B%0A%20%20%20%20%20%20var%20script%20%3D%20document.createElement(%22script%22)%3B%0A%20%20%20%20%20%20script.setAttribute(%22id%22%2C%20%22jquery-script%22)%3B%0A%20%20%20%20%20%20script.setAttribute(%22src%22%2C%20%22%2F%2Fcode.jquery.com%2Fjquery.js%22)%3B%0A%20%20%20%20%20%20document.getElementsByTagName(%22body%22)%5B0%5D.appendChild(script)%3B%0A%20%20%20%20%7D%0A%20%20%20%20setTimeout(requireJQuery.bind(this%2C%20fn)%2C%201000)%3B%0A%20%20%7D%0A%7D%0A%0Afunction%20parseTestFailures()%20%7B%0A%20%2
#!/bin/sh
# A custom script which adds entries to LSApplicationQueriesScheme, for
# whitelisting application schemes that can be used to trigger FB/Instagram/etc
# shares. We can't use <config-file> directive in config.xml because
# cordova-plugin-facebook4 overwrites our custom values in the resulting
# *-Info.plist file. To add schemes to LSApplicationQueriesScheme, add
# them to the schemes array below.
# To enable this script, add hooks to your config.xml:
@elijahr
elijahr / .travis.yml
Last active August 29, 2020 17:23 — forked from genotrance/travis.sh
Travis CI setup for Nim
os: linux
dist: bionic
language: c
matrix:
include:
# Linux - amd64
- env: BRANCH=0.20.2
- env: BRANCH=1.0.8
- env: BRANCH=1.2.6