Skip to content

Instantly share code, notes, and snippets.

View stan's full-sized avatar
💭
¯\_(ツ)_/¯

stan

💭
¯\_(ツ)_/¯
View GitHub Profile
@stan
stan / gist:777387
Created January 13, 2011 04:25 — forked from vrinek/gist:451508
// http://stackoverflow.com/questions/3503660/upgrading-with-parameter-on-a-link-to-remote-in-rails-3
// http://railsforum.com/viewtopic.php?id=42215
// http://stackoverflow.com/questions/2508213/rails3-link-to-with-attribute
$$('a[data-remote=true]').each(function(a){
a.onclick = function(){
href = a.getAttribute('href');
url = href.split('?')[0];
params = href.split('?')[1];
newParam = encodeURI(eval(a.getAttribute('data-with')));
@stan
stan / gist:958845
Created May 6, 2011 12:14
gem pristine --all --no-extensions
gem pristine --all --no-extensions
@stan
stan / 0_instructions.txt
Created May 19, 2011 02:25 — forked from sgruhier/0_instructions.txt
Sprocket 2 in Rails 3.0.x ala Rails 3.1
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
filesystem will be different but this guide will get you working with it
while we wait for all that to finalize.
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist.
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention
@stan
stan / jquery.filterbydata.js
Created July 20, 2011 01:19 — forked from elijahmanor/jquery.filterbydata.js
filterByData jQuery Plugin
// http://www.elijahmanor.com/2011/07/filterbydata-jquery-plugin.html
// https://gist.github.com/1048942
(function($) {
/* by Elijah Manor with collaboration from Doug Neiner
* Filter results by html5 data attributes either at
* design or at runtime
*
* Usages:
ActionController::RoutingError (No route matches "/webconsole"):
lib/rack/runtime.rb:18:in `call'
Rendered /home/stan/.rvm/gems/ruby-1.9.2-p290@skeleton/gems/actionpack-3.0.9/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.3ms)
@stan
stan / changes.diff
Created October 12, 2011 06:37
Differences between Rails 3.0.9 & Rails 3.1.1 generated apps (all in one)
Only in 3.1.1/blank/app: assets
Only in 3.1.1/blank/app/mailers: .gitkeep
Only in 3.1.1/blank/app/models: .gitkeep
diff -U 0 -r 3.0.9/blank/app/views/layouts/application.html.erb 3.1.1/blank/app/views/layouts/application.html.erb
--- 3.0.9/blank/app/views/layouts/application.html.erb 2011-10-12 15:17:34.853020000 +0900
+++ 3.1.1/blank/app/views/layouts/application.html.erb 2011-10-12 15:23:26.162309000 +0900
@@ -5,3 +5,3 @@
- <%= stylesheet_link_tag :all %>
- <%= javascript_include_tag :defaults %>
- <%= csrf_meta_tag %>
@stan
stan / gist:1704142
Created January 30, 2012 12:24
Look Up in 1Password
javascript:window.location='onepassword://'+window.location.href.substring(window.location.href.indexOf('//')+2)
@stan
stan / undo.rb
Created September 27, 2012 10:08
Undo for mongoid
module Mongoid
module Undo
extend ActiveSupport::Concern
included do
include Mongoid::Document
field :version, type: Integer, default: 0
before_save :prepare_versioning
after_save :create_version
@stan
stan / 1.9.3-p385-falcon
Last active December 12, 2015 12:09
Performance patch for rbenv ruby 1.9.3-p385 (funny-falcon with backport-gc)
build_package_combined_patch() {
local package_name="$1"
{
curl https://github.com/funny-falcon/ruby/compare/p385...p385_falcon_gc.diff | patch -p1
autoconf
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
make -j 8
make install
} >&4 2>&1
@stan
stan / 1.9.3-p392-railsexpress
Last active December 15, 2015 02:09
1.9.3-p392-railsexpress
build_package_combined_patch() {
local package_name="$1"
{
curl https://raw.github.com/skaes/rvm-patchsets/master/patchsets/ruby/1.9.3/p392/railsexpress | xargs -I % curl https://raw.github.com/skaes/rvm-patchsets/master/patches/ruby/1.9.3/p392/% | patch -p1
autoconf
./configure --prefix="$PREFIX_PATH" $CONFIGURE_OPTS
make -j 8
make install
} >&4 2>&1