Skip to content

Instantly share code, notes, and snippets.

View L1fescape's full-sized avatar

Andrew Kennedy L1fescape

View GitHub Profile
@L1fescape
L1fescape / chat-server.js
Created May 1, 2013 16:02
Simple Chat Server Nodejs chat server that serves two static files (index.html and jquery.js), allowing clients to communicate via a basic web interface. Use npm install socket.io node chat-server.js
// Global variables
var app = require('http').createServer(handler)
, io = require('socket.io').listen(app)
, fs = require('fs')
, url = require('url')
, port = 1337
// initialize http server
app.listen(port);
console.log("Listening on port", port)
@L1fescape
L1fescape / gist:5496744
Last active December 16, 2015 20:59
Fallback from cdn to local jquery
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.0.0.min.js"></script>
<script>window.jQuery || document.write('<script src="js/jquery-2.0.0.min.js">\x3C/script>')</script>
<!-- or Require js -->
<script>
requirejs.config({
enforceDefine: true,
paths: {
@L1fescape
L1fescape / config.log
Created June 26, 2013 19:43
ruby-install Mavericks error
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by configure, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/Users/akennedy/.rubies/ruby-2.0.0-p195 --with-opt-dir=/usr/local/opt/openssl:/usr/local/opt/readline:/usr/local/opt/libyaml:/usr/local/opt/gdbm:/usr/local/opt/libffi
## --------- ##
## Platform. ##
var growly = require('growly');
growly.notify("test", {title : "wooot", sticky : true});
@L1fescape
L1fescape / reqParams.js
Last active December 22, 2015 20:29
Required params for NodeJS. Basic working example, needs improvements.
function required(params) {
return function (req, res, cb) {
if (params.every(function (elem) { return req.body.hasOwnProperty(elem); }))
cb();
else
res.send(400, {status:400, message: 'Missing required body parameters.'});
};
};
/*
return View.extend({
initialize: function () {
this.el.attr("draggable", "true")
this.el.bind("dragstart", _.bind(this._dragStartEvent, this))
},
_dragStartEvent: function (e) {
var data
if (e.originalEvent) e = e.originalEvent
e.dataTransfer.effectAllowed = "copy" // default to copy
@L1fescape
L1fescape / example.py
Last active December 25, 2015 13:49
Helper file for setting up Grooveshark API sessions and making requests.
from gsapi import GSApi
api = GSApi()
username = "L1fescape"
response = api.call_remote('getUserIDFromUsername', username=username)
userID = response['result']['UserID']
response = api.call_remote('getUserPlaylistsByUserID', userID=userID)
playlists = response['result']['playlists']
#/usr/bin/env bash
set -e
set -x
apt-get update
apt-get upgrade
apt-get -y install build-essential curl git-core openssl libreadline6 libreadline6-dev \
zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev \
<a onclick="wp_showhide.main(this, 'paul')" href="javascript:void(0)">
["Paul", "Paul", "hidden"]
</a>
<a onclick="wp_showhide.main(this, 'bob')" href="javascript:void(0)">
["Bob", "Bob", "hidden"]
</a>
<a onclick="wp_showhide.main(this, 'steve')" href="javascript:void(0)">
["Steve", "Steve", "hidden"]
public class TheRollingStones {
private int satisfaction;
public void setSatisfaction(int satisfaction) {
this.satisfaction = satisfaction;
}
public void getSatisfaction() {
}
}