Skip to content

Instantly share code, notes, and snippets.

View triptych's full-sized avatar
💭
Making web things

Andrew Wooldridge triptych

💭
Making web things
View GitHub Profile
@cflewis
cflewis / gist:63959
Created February 13, 2009 15:44
An Inform 7 tale about an incident on a plane.
"plane" by Chris Lewis
The release number is 1. The story creation year is 2009. The story headline is "Plane: A Tale of Pride". The story genre is "Medieval Morality". The story description is "A story about love at 30 000 feet.". Use no scoring.
The Cabin is a room. "The cabin is a long thin corridor surrounding you, bright light piercing the tin can that is propelling you at 600 mph through the lower atmosphere. A putrid smell of various processed food stuffs mixes with the thin air. People in various states of personal detachment are to your left and right. Some are sleeping, some are watching 'Beverly Hills Chihuahua'. They are essentially zombies.
You wonder if zombies actually come alive on aeroplanes. Then they could be immortal humans, doomed to be locked in on an eternal long-haul flight. You ponder this possibility for some time.
To the south are the bathrooms.
// How awful is this approach? Really awful? Not awful?
// Cuz it seems not awful, and actually really convenient.
// Note how MyComponent has a single instance of YUI(),
// but without having to wrap the whole thing in the YUI call.
// This means that MyComponent can be extended later on,
// and still use the same single instance of YUI.
MyComponent = (function () {
var myYUI = null
var load = function (fn) {
/*
* An example of
* 1. Using the YUI 3 module system to encapsulate a custom class for reuse
* 2. Creating a Plugin class
* 3. Using Y.Base.create to generate the class
*/
// YUI.add(
// "dash-separated-module-name",
// function (Y) { Y.MyModule = ...; },
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active July 21, 2024 01:20
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
// input :: <hr/>
Y.all('hr').each(function(hr){
var div = Y.Node.create('<div class="hr"/>');
Y.Node.insertBefore(div, hr);
div.append(hr.remove());
});
YUI({filter: 'raw', combine : false}).use('node', 'scrollview', function(Y) {
var scrollView = new Y.ScrollView({
srcNode: '#searchresults', //where #searchresults is a wrapper div on the table rows.
height: 350
});
scrollView.render();
});
#!/bin/bash
SERVER=https://api.no.de
SCRIPT="$0"
if [ ${SCRIPT:0:1} == "/" ]; then
SCRIPT="$(basename -- "$SCRIPT")"
fi
main () {
cmd=${1-help}
/*** CAREERS ***/
var resumeSubmitBtn = Y.one('#job-submit-resume'),
friendSubmitBtn = Y.one('#job-send-to-a-friend');
resumeSubmitBtn.on('click', function(e){
// get xhr response text
Y.io('/xhr/submit-resume.php?title=' + Y.one('#job_title').get('value') + '&job_subject=' + Y.one('#job_subject').get('value'), {
on : {
success : function(id, o, args) {
YUI.add('node++', function (Y) {
// define a function that will run in the context of a
// Node instance:
function doSomethingAwesome() {
Y.log("Do something awesome here.");
}
// use addMethod to add doAwesomeThing to the Node prototype:
Y.Node.addMethod("doAwesomeThing", doSomethingAwesome);
✔ YQL on Chrome (6.0.472.63) / MacOS
3 passed, 0 failed
✔ YQL on Safari (5.0.1) / MacOS
3 passed, 0 failed
✔ YQL on Firefox (3.6.10) / MacOS
3 passed, 0 failed
✔ YQL on Chrome (6.0.472.63) / Windows