Skip to content

Instantly share code, notes, and snippets.

View paul-english's full-sized avatar

Paul English paul-english

View GitHub Profile
# Used for the subspaceplot on our covariance matrix
# install.packages('MCMCglmm')
Tweets = read.csv("twitter_data.csv", col.names= c("created_at", "id", "user_id", "followers_count", "friends_count", "listed_count", "favourites_count", "statuses_count", "retweet_count", "latitude", "longitude"))
finite_values = tweets[c("followers_count", "friends_count", "listed_count", "favourites_count", "statuses_count", "retweet_count", "latitude", "longitude")]
# Find followers and tweets by id
boxplot(split(tweets$followers_count,tweets$user_id),main='Followers per user')
boxplot(split(tweets$statuses_count,tweets$user_id),main='Tweets per user')
var assert = require('assert');
function symmetryPoint ( S ) {
if (S.length % 2 === 0) {
return -1;
} else {
var middle = Math.floor(S.length / 2);
var front = S.substr(0, middle);
var back = S.substr(middle+1, S.length);
var assert = require('assert');
function rice_chessboard (A) {
if (A.length === 0) return 0;
if (A[0].length === 0) return 0;
var count = A[0][0];
var left_path = extract_sub(0, A);
function smsInboundCallback (req, res) {
console.log('smsInboundCallback', req.body);
// { AccountSid: 'AC64065c2140fe4bf6849b13316fe1847a',
// ApiVersion: 'v1',
// Body: 'Oh hai',
// From: '+18012101024',
// SmsSid: 'SMa4bfb6db0a10413bad796d33ca0dcadf',
// SmsStatus: 'sent',
// To: '+12676708074' }
<div class="container">
<div class="row">
<div id="sideOne" class="span2">
<div></div>
<div></div>
<div></div>
</div>
<div id="main" class="span8">
{{content}}
</div>
var http = require(++++++++++[>++++++++++<-]>++++.[-]++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>+++++++++++<-]>++.[-]);
http.createServer(function (req, res) {
res.writeHead(++++++++++[>+++++<-]>.[-]++++++++++[>++++<-]>++++++++.[-]++++++++++[>++++<-]>++++++++.[-], {++++++++++[>++++++<-]>+++++++.[-]++++++++++[>+++++++++++<-]>+.[-]++++++++++[>+++++++++++<-]>.[-]++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>++++++++++<-]>+.[-]++++++++++[>+++++++++++<-]>.[-]++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>++++<-]>+++++.[-]++++++++++[>++++++++<-]>++++.[-]++++++++++[>++++++++++++<-]>+.[-]++++++++++[>+++++++++++<-]>++.[-]++++++++++[>++++++++++<-]>+.[-]: ++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>++++++++++<-]>+.[-]++++++++++[>++++++++++++<-]>.[-]++++++++++[>+++++++++++<-]>++++++.[-]++++++++++[>++++<-]>+++++++.[-]++++++++++[>+++++++++++<-]>++.[-]++++++++++[>++++++++++<-]>++++++++.[-]++++++++++[>+++++++++<-]>+++++++.[-]++++++++++[>++++++++++<-]>+++++.[-]++++++++++[
@paul-english
paul-english / httpStatusDescriptions.js
Created October 16, 2012 18:27
Javascript object mapping HTTP Status Codes to a human readable description
window.statusCodeDescription = {
100: "Continue",
101: "Switching Protocols",
102: "Processing",
200: "OK",
201: "Created",
202: "Accepted",
203: "Non-Authoritative Information",
204: "No Content",
205: "Reset Content",
@paul-english
paul-english / eco-snipppet.coffee
Created March 26, 2012 17:14
trick to make eco templates work well with asset pipeline
# Client side eco templating
assets.jsCompilers.eco =
match: /\.eco$/
compileSync: (sourcePath, source) ->
fileName = path.basename sourcePath, '.eco'
directoryName = (path.dirname sourcePath).replace "#{__dirname}/public/js/templates", ""
jstPath = if directoryName then "#{directoryName}/#{fileName}" else "/#{fileName}"
"(function() {window.JST || (window.JST = {});window.JST['#{jstPath}'] = #{eco.precompile source}}).call(this);"
app.set 'view engine', 'eco'
@paul-english
paul-english / jquery-validate-bootstrap-patch.coffee
Created March 26, 2012 03:51
Monkey patches that are designed to help jquery-validate work well with Twitter Bootstrap
# These patches help make the jquery validator work well with
# the Twitter Bootstrap html & class conventions
#
# MONKEY-PATCH warning
# These may need to be adjusted if upgrading or changing jquery-validate
# from 1.9.0
$.validator.setDefaults
errorClass: "error"
validClass: "success"
# https://github.com/DanielRapp/twss.js
# https://github.com/jdub/node-twitter
twitter = require("twitter")
twss = require("twss")
twit = new twitter(
consumer_key: ""
consumer_secret: ""
access_token_key: ""
access_token_secret: ""
)