Skip to content

Instantly share code, notes, and snippets.

@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:

#!/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
@jasoncodes
jasoncodes / README
Last active May 1, 2024 21:29
Remote Chrome browser for Capybara
On the shared machine:
Download http://code.google.com/p/selenium/downloads/detail?name=selenium-server-standalone-2.33.0.jar&can=2&q=
$ brew install chromedriver
$ java -jar selenium-server-standalone-2.33.0.jar
On the local machine:
Set `CHROME_HOSTNAME` in your `.env`, `.rbenv_vars`, or per run.
@bryhal
bryhal / gist:4129042
Created November 22, 2012 02:08
MYSQL: Generate Calendar Table
DROP TABLE IF EXISTS time_dimension;
CREATE TABLE time_dimension (
id INTEGER PRIMARY KEY, -- year*10000+month*100+day
db_date DATE NOT NULL,
year INTEGER NOT NULL,
month INTEGER NOT NULL, -- 1 to 12
day INTEGER NOT NULL, -- 1 to 31
quarter INTEGER NOT NULL, -- 1 to 4
week INTEGER NOT NULL, -- 1 to 52/53
day_name VARCHAR(9) NOT NULL, -- 'Monday', 'Tuesday'...
@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"
@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();
@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
@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),
@LeZuse
LeZuse / detect.py
Created May 2, 2012 18:28
Flask browser detection
browser = request.user_agent.browser
version = request.user_agent.version and int(request.user_agent.version.split('.')[0])
platform = request.user_agent.platform
uas = request.user_agent.string
if browser and version:
if (browser == 'msie' and version < 9) \
or (browser == 'firefox' and version < 4) \
or (platform == 'android' and browser == 'safari' and version < 534) \
or (platform == 'iphone' and browser == 'safari' and version < 7000) \
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"