Skip to content

Instantly share code, notes, and snippets.

View thehack's full-sized avatar

Tim Inman thehack

View GitHub Profile
@thehack
thehack / index.html
Created December 8, 2019 03:47
Javscript for snow
<h1>JavaScript Snow</h1>
@thehack
thehack / tricks.html
Last active December 12, 2015 04:19
Some JavaScript Tricks
<!-- This goes under your link menu if you have one -->
<h1>Some Javascript Tricks</h1>
Name: <input id="name" type="text" onkeyup="document.getElementById('response').innerHTML = 'Hi, ' + this.value + '. I hope you enjoy this.';">
<br>
Color: <input id="color" type="text" onkeyup="document.body.style.backgroundColor=this.value;">
<p id="response"></p>
@thehack
thehack / gist:4615814
Created January 23, 2013 23:39
A script to save all the lemmings on this playable 404 page: http://www.romainbrasier.fr/404.php?lang=en . You can just copy and paste the following into your browser's javascript console.
var saveTheirSouls = function() {
$('img').trigger('mouseover');
setTimeout( function() {
if ($('img').length > 1) {
return saveTheirSouls()
}
else {
return false;
}
@thehack
thehack / phrase_splitter.rb
Created June 6, 2011 12:59
I'm trying to split a phrase into 6 or less rows of 12 or less letters each.
#!/usr/bin/ruby
puts "Enter phrase. 60 characters or less."
phrase = gets.chomp
words = phrase.downcase.gsub(/[^a-z ]/, "").split(" ")
word_count = words.length
word_lengths = []
words.each { |word| word_lengths << word.length }
@thehack
thehack / Rainbows!+Coolio.rb
Created December 30, 2010 14:53
Need Help. Trying to figure out how to build a chat application like node.js example with Rainbows! and Coolio
# config.ru
app = proc do |env|
[ 200, {'Content-Type' => 'text/html'}, "hello world" ]
end
run app
# coolio_config.rb
require 'cool.io'
@thehack
thehack / sinatra test
Created December 17, 2010 11:42
trying to set up a cool.io chat server with sinatra. Please advise.
#!/usr/bin/ruby
require 'rubygems'
require 'sinatra'
require 'cool.io'
#config
ADDR = '127.0.0.1'
PORT = 4321
@thehack
thehack / README.rdoc
Created November 12, 2010 11:44 — forked from woodie/README.rdoc
I changed the setup script name to rails2310_appengine.rb

Rails 2.3.10 on App Engine (DataMapper)

Do not use rvm (or install and run from JåRuby). The google-appengine gem must install into your system MRI. The appengine-sdk gem includes a complete Java app server. We bootstrap Java from MRI, then your app runs inside a servlet container (with access to all the APIs) using the version of JRuby installed into each app.

We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.x calls to rubygems, and now we have it working. Rails 2.3.x currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.

See the TInyDS version also: gist.github.com/gists/269075

Install the Development Environment