Skip to content

Instantly share code, notes, and snippets.

View jnstq's full-sized avatar

Jon Stenqvist jnstq

  • Equipe AB
  • Helsingborg, Sweden
View GitHub Profile
@jnstq
jnstq / gist:41771
Created December 30, 2008 22:03 — forked from peterc/gist:33337
# SUPER DARING APP TEMPLATE 1.0
# By Peter Cooper
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/dev/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm public/index.html"
run "rm public/favicon.ico"
require 'rubygems'
require 'benchmark'
gem = ARGV.shift.strip rescue ''
if gem == ''
STDERR.puts "usage: #{$0} [gem]"
exit 1
end
`free`
require 'rubygems'
require 'benchmark'
gem = ARGV.shift.strip rescue ''
if gem == ''
STDERR.puts "usage: #{$0} [gem]"
exit 1
end
`free`
=== Epic Snow Leopard Upgrayyyyd Guide ===
Son, you’re now living in the land of 64-bit systems.
That means that some of your 32-bit shit is now broken.
Not all is lost.
== Fixing MySQL weirdness
require 'activerecord'
require 'active_record/base'
require 'active_record/validations'
module ActionDuck
def self.included(klass)
klass.extend ClassMethods
klass.send(:include, InstanceMethods)
end
@jnstq
jnstq / gist:232422
Created November 11, 2009 23:13 — forked from ismasan/gist:229343
/* Jquery plugin for quick Comet long polling connections
Nothing special about this (just a recursive Ajax call).
The key is having the server hold connections open until there's data to push back to the client.
This can be done with Nginx and the nginx_http_push_module (http://github.com/slact/nginx_http_push_module)
---------------------------------------------------------------------------*/
(function($){
var changed, etag;
var wait = 1000;
$.comet = function(url, success_callback, error_callback) {
namespace :bundler do
task :install do
run("gem install bundler --source=http://gemcutter.org")
end
task :symlink_vendor do
shared_gems = File.join(shared_path, 'vendor/gems')
release_gems = "#{release_path}/vendor/gems/"
%w(cache gems specifications).each do |sub_dir|
shared_sub_dir = File.join(shared_gems, sub_dir)
@jnstq
jnstq / Gemfile
Created February 15, 2010 21:38 — forked from indirect/Gemfile
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
group :development do
# bundler requires these gems in development
gem 'rails-footnotes'
end
group :test do
@jnstq
jnstq / 9.04.sh
Created May 24, 2010 08:05 — forked from mrrooijen/9.04.sh
# Author: Michael van Rooijen
# Description:
# A Rails Stack Installer for Ubuntu 8.04/9.04 with the light-weight and fast NginX Web Server.
# This shell script will install a basic Rails Stack with a bunch of useful and commonly used utilities.
# It will install Ruby Enterprise Edition with Phusion Passenger (Reduces Rails Application Memory Usage By Approx. 33%)
# It will install some essential gems like mysql, sqlite, postgres etc.
# It will install NginX Web Server
# It will install the MySQL database
# It will install Git
# It will install these utilities: ImageMagick, FFMpeg, Memcached
/* Ismael Celis 2010
Simplified WebSocket events dispatcher (no channels, no users)
var socket = new ServerEventsDispatcher();
// bind to server events
socket.bind('some_event', function(data){
alert(data.name + ' says: ' + data.message)
});