Skip to content

Instantly share code, notes, and snippets.

@deanohyeah
deanohyeah / gist:df972fea8daa13e6b14f
Created January 22, 2016 21:23
Nodejs script to start jenkins build and poll for status
#!/usr/bin/env node
var request = require('request'),
fs = require('fs'),
Promise = require('bluebird'),
baseUrl = '',
patchName = process.argv[2].toString(),
formData = {
file0: fs.createReadStream(`/Users/skytap/src/current/ui_nodejs/.hg/patches/${patchName}`),
json: '{"parameter":[{"name":"ui_nodejs/.hg/patches/test_patch","file":"file0"}]}'
};
@deanohyeah
deanohyeah / macVim setup
Last active August 29, 2015 13:57
Set up vim with mac vim
Download latest version of mac vim
https://github.com/b4winckler/macvim/releases
Install pathogen.vim(manages plugins)
http://www.vim.org/scripts/script.php?script_id=2332
Install a theme possibly:
https://github.com/altercation/vim-colors-solarized
Install CtrlP
@deanohyeah
deanohyeah / .vimrc
Last active October 17, 2015 05:52
.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
" Ctrlp options
let g:ctrlp_root_markers = ['.ctrlp']
let g:ctrlp_prompt_mappings = {
\ 'AcceptSelection("e")': ['<c-t>'],
\ 'AcceptSelection("t")': ['<cr>', '<2-LeftMouse>'],
\ }
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*.,*/.DS_Store,*/tmp/*
@deanohyeah
deanohyeah / python geocode function
Created September 24, 2013 17:01
python function to use googles geocoding. import requests
def _geocode(self, address, *args, **kwargs):
url = 'http://maps.googleapis.com/maps/api/geocode/json'
payload = {
'address': address+' '+self.state,
'sensor': 'false',
}
r = requests.get(url, params=payload)
if r.status_code == 200:
data = r.json
@deanohyeah
deanohyeah / Fixed div, hug footer
Created September 4, 2013 18:20
Fixes a div and unfixes when the footer comes in.
@deanohyeah
deanohyeah / js script loader
Created September 4, 2013 18:18
Load a script with a call back when it is done loading. For scripts that depend on each other
function loadScript(url, callback){
var script = document.createElement("script")
script.type = "text/javascript";
if (script.readyState){ //IE
script.onreadystatechange = function(){
if (script.readyState == "loaded" ||
script.readyState == "complete"){
script.onreadystatechange = null;
@deanohyeah
deanohyeah / js mediaquery
Created August 22, 2013 23:01
js mediaquery
<script type="text/javascript">
var mediaQuery;
//checks for browser support ie < 10 no support
if(typeof window.matchMedia == 'function'){
mediaQuery = window.matchMedia("(max-width: 767px)").matches;
}else{
mediaQuery = false;
}
if (!mediaQuery) {
@deanohyeah
deanohyeah / Share code
Last active December 20, 2015 16:29
random sniipets
d
Merge results into master
git push <app remote> master
heroku run bash --app <app-name>
python seatimes/manage.py syncdb
python seatimes/manage.py migrate people 0001 --fake
python seatimes/manage.py migrate legislators 0001 --fake
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(name):
text = name['name']
sortKey = [ atoi(c) for c in re.split('(\d+)', text) ]
try:
return sortKey[1],sortKey[0],sortKey[3]
except: