Skip to content

Instantly share code, notes, and snippets.

@tonyfast
tonyfast / bokeh_and_pyyaml.ipynb
Last active August 29, 2015 14:27
Building Interactions between the IPython notebook and Bokeh Plots
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@stephenvisser
stephenvisser / app.js
Created May 16, 2012 15:45
Using Twitter Bootstrap NavBars with Backbone.js
//This is the Backbone controller that manages the content of the app
var Content = Backbone.View.extend({
initialize:function(options){
Backbone.history.on('route',function(source, path){
this.render(path);
}, this);
},
//This object defines the content for each of the routes in the application
content:{
"":_.template(document.getElementById("root").innerHTML),
@dwwoelfel
dwwoelfel / gist:b859cee4b5f41af37ffd
Created August 1, 2014 21:05
Rough notes for setting up elastic beanstalk on CircleCI

In your repo's root directory, check in a requirements.txt with

boto==2.30.0

Then, from the project's Project Settings > Environment Variables page, add the two env vars: AWS_ACCESS_KEY_ID and AWS_SECRET_KEY, with an IAM key that can deploy to eb.

Then create a bash script to set up eb:

@iwek
iwek / grab-html-source.js
Created October 21, 2012 19:00
grab html source in casperjs or phantomjs
//phantomjs
var page = require('webpage').create();
var url = 'http://instagram.com/';
page.open(url, function (status) {
var js = page.evaluate(function () {
return document;
});
console.log(js.all[0].outerHTML);
phantom.exit();
@rchampourlier
rchampourlier / capybara_remote.rb
Created November 8, 2012 11:07
Capybara configuration connecting to selenium server for testing with a remote browser (pretty useful in Vagrant)
# SELENIUM_SERVER is the IP address or hostname of the system running Selenium
# Server, this is used to determine where to connect to when using one of the
# selenium_remote_* drivers
SELENIUM_SERVER = "10.10.11.1"
# SELENIUM_APP_HOST is the IP address or hostname of this system (where the
# tests run against) as reachable for the SELENIUM_SERVER. This is used to set
# the Capybara.app_host when using one of the selenium_remote_* drivers
SELENIUM_APP_HOST = "10.10.11.2"
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@brianboyer
brianboyer / gist:c9d412a26cb57b5ebbc7
Created November 6, 2014 14:57
Convert a mailbox file into CSV
# assumes your file is called mbox (which it is if you export from Mac Mail)
# writes to a file called mbox.csv
import mailbox
import csv
# motherfucking recursion, because email is damn weird.
# each payload can contain many other payloads, which can contain many *other* payloads
# this only exports the text/plain payload, the thing you read
def more_payloads(message):
@varyonic
varyonic / docker-compose.yml
Last active May 18, 2021 13:18
Capybara standalone Selenium Chrome config
web:
build: .
volumes:
- .:/opt/myapp
ports:
- '3000:3000'
links:
- db
- redis
- selenium
@n1k0
n1k0 / Howto.md
Created October 1, 2012 17:59
CasperJS test cli hooks example

Put test1.js and test2.js into a tests/ directory, then run the suite:

$ casperjs test tests/ --pre=pre.js --includes=inc.js --post=post.js
Test file: /Users/nperriault/tmp/pre-inc/pre.js                                 
Hey, I'm executed before the suite.
Test file: /Users/nperriault/tmp/pre-inc/tests/test1.js                         
# this is test 1
Hi, I've been included.
PASS Subject is strictly true
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}