Skip to content

Instantly share code, notes, and snippets.

View stenehall's full-sized avatar
🧗‍♂️

Johan Stenehall stenehall

🧗‍♂️
View GitHub Profile
@stenehall
stenehall / New stack
Created December 12, 2010 21:16
Suggested stack improvements
<?php
/*
* README
* mkdir one && mkdir two && mkdir three && touch one/blueprint-1.3.css && touch one/foobar.css && touch two/jquery.js && touch three/jquery-1.4.js
*
*/
include('stack.php');
public function action_hash($hash)
{
Request::factory('application/index/?invite=a156cd8a95b52422032820f830db8fab')
->execute()
->send_headers()
->body();
die();
}
public function action_index()
@stenehall
stenehall / gist:2493577
Created April 25, 2012 21:25
Rotating backgrounds for OS X Lion
#!/usr/bin/env ruby
require 'nokogiri'
require 'open-uri'
require 'pathname'
require 'appscript'
require 'json'
include Appscript, MacTypes
@stenehall
stenehall / README.markdown
Created June 3, 2012 14:54 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things (fixing the RegExp for diverdude so that search works with [)

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
### config.ru
require_relative_fix 'helpers/init'
require_relative_fix 'models/init'
### user_model.rb
helpers do
def private
if session[:user_id]
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Comix Sample</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@stenehall
stenehall / pullDatabase.rb
Created April 9, 2013 07:00
Put pushDatabase and pullDatabase in your ~/bin folder. I've removed the extension for easier access.
#!/usr/bin/env ruby
# encoding: utf-8
require 'rubygems'
require 'net/ssh'
require 'rainbow'
if ARGV[0] && ! ARGV[0].empty?
name = ARGV[0]
db_output = %x[ssh {} 'mysql -u{server user} -p{server password} -e "SHOW DATABASES"']
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<script>
if (window.location.search == '?phonegap')
{
document.getElementsByTagName('html')[0].className = 'phone-gap'
}
var Game = function Game() {
this.marks = [];
};
Game.prototype.add_mark = function add_mark(pins) {
this.marks.push(pins);
};
Game.prototype.score = function score() {
// Tower of Hanoi
// http://www.dynamicdrive.com/dynamicindex12/towerhanoi.htm
var Hanoi = function Hanoi() {
};
Hanoi.prototype.solve = function solve(disks) {
// Solve it!
}