Skip to content

Instantly share code, notes, and snippets.

View samchrisinger's full-sized avatar

Sam Chrisinger samchrisinger

  • United States
View GitHub Profile
@samchrisinger
samchrisinger / travis.md
Created May 19, 2016 16:14
Your Own Personal Travis
  1. Create a Travis CI account
  2. Go to your profile page
  3. Find your fork of osf.io (mine is samchrisinger/osf.io), flip the toggle to make it green
  4. Click the little gear. Make sure "Build pushes" is active. Maybe set "Build pull requests" too.
  5. Push any code to your fork of osf.io, Travis runs your tests without cluttering the CenterForOpenScience build queue.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>jQuery Experimenter Interface</title>
</head>
<body>
<select id="exp"></select>
<select id="session"></select>
@samchrisinger
samchrisinger / .generate_invoke_completion.py
Created November 13, 2015 00:16
bash autocomplete for OSF invoke tasks
def main():
f = open('tasks.py', 'r')
tasks = []
lines = f.read().split('\n')
f.close()
for i in range(len(lines)):
line = lines[i]
if '@task' in line:
opt = lines[i + 1].replace('def ', '').split('(')[0]
tasks.append(opt)
#!/bin/bash
# from http://davidsj.co.uk/blog/delete-queues-in-rabbitmq/
for queue in `rabbitmqadmin -f bash list queues`; do echo $queue `rabbitmqadmin delete queue name=$queue`; done
@samchrisinger
samchrisinger / limits.sh
Last active August 29, 2015 14:19
Script for fixing "Too many open files" with Mongodb
#!/bin/bash
sudo launchctl limit maxfiles 8096 8096
sudo launchctl limit maxproc 8096 8096
ulimit -n 8096
ulimit -u 1024
@samchrisinger
samchrisinger / commit_message_template
Last active July 10, 2017 22:42
Git commit message template
# Is this WIP or a minor change?
# [skip ci]
# Are you ready to indicate a related Jira issue?
# [#OSF- ]
# Style guidelines
# ----------------
# Capitalized, short (50 chars or less) summary
#
from __future__ import print_function
import uuid
import time
from datetime import datetime
fts = datetime.fromtimestamp
from webbrowser import open_new_tab
from random import randint
from requests.exceptions import ConnectionError
@samchrisinger
samchrisinger / gist:5920e2aeb93abbf9d316
Last active August 29, 2015 14:04
Bokeh simple histogram
from __future__ import print_function
import uuid
import time
from datetime import datetime
fts = datetime.fromtimestamp
from webbrowser import open_new_tab
from random import randint
from requests.exceptions import ConnectionError
@samchrisinger
samchrisinger / gist:7491189
Created November 15, 2013 20:40
jQuery form serialize
$('#submit').on('click', function(e){
e.preventDefault(); //IMPORTANT-- you must stop the form from automatically sending a POST request
var obs = $('#observer_form').serializeArray();
var met = $('#metrics_form').serializeArray();
var site = $('#site_form').serializeArray()
});
// This returns three arrays of objects like {name:NAME, value:VALUE}. This is grabbing the HTML name attribute of the form contents as well at their values. I've added check boxes next to my <input> tags so blank fields don't get submitted. This looks something like:
$('.toggle').on('change', function(){
@samchrisinger
samchrisinger / gist:7436061
Created November 12, 2013 18:22
using HTTPS with jQuery for mobile login
$('#loginsubmit').on('click', function(){
$.post('https://pegasus.cs.virginia.edu/rcs/tokens.json',
{email: $('#email').val(),
password: $('#password').val()},
function(res){
console.log(res.token);
}).error(function(err){
console.log(err);
});
});