Skip to content

Instantly share code, notes, and snippets.

@tmm1
tmm1 / gist:504342
Created August 2, 2010 08:37
rails3 patch for perftools.rb cpu/object profiling
diff --git a/Gemfile b/Gemfile
index fd90d42..9dd0146 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,4 +1,6 @@
source 'http://rubygems.org'
+gem 'perftools.rb', '>= 0.4.4'
+gem 'rack-perftools_profiler'
gem 'rails', '3.0.0.rc'
@doitian
doitian / wlist.rb
Created August 26, 2010 14:03
List windows for gpicker.
#!/usr/bin/env ruby
workspaces = {}
`wmctrl -d`.each_line do |line|
columns = line.split
if columns[7] == "N/A"
workspace_name = columns[8..-1].join(" ")
else
workspace_name = columns[9..-1].join(" ")
end
@josevalim
josevalim / 1_README.md
Created December 13, 2011 09:30
FSSM based FileWatcher for Rails

Rails 3.2 ships with a simple FileWatcher that only reloads your app if any of the files changed.

Besides, it also provides a mechanism to hook up your own file watcher mechanism, so we can use tools like FSSM that hooks into Mac OS X fsevents. This is an example on how to hook your own mechanism (you need Rails master, soon to be Rails 3.2):

  1. Copy the 2_file_watcher.rb file below to lib/file_watcher.rb

  2. Add the following inside your Application in config/application.rb

if Rails.env.development?

{-# OPTIONS_GHC -fcontext-stack=32 #-}
{-# LANGUAGE TypeSynonymInstances, DeriveDataTypeable, MultiParamTypeClasses #-}
import XMonad hiding ( (|||) )
import qualified XMonad.StackSet as W
import Control.OldException(catchDyn,try)
import Data.Char (toLower)
import Data.Monoid (mappend)
import Data.List (intercalate, intersperse, isSuffixOf, isPrefixOf)
#>>lang=cf
@Factory = Factory = {}
ids = {}
sequences = {}
sequence = (name, callback) -> sequences[name] = callback
define = (name, defaults = {}) ->
Factory[name] = (attrs = {}) ->
@doitian
doitian / specs.js.coffee
Created March 12, 2012 19:33
3 ways to test ajax requests or other asynchronouse lib based on jquery deferred
# The second way is recommended, which is flexible, and also work for non jQuery ajax library.
# Setup sinon sandbox
beforeEach ->
@sinon = sinon.sandbox.create()
afterEach ->
@sinon.restore()

ruby-1.9.3-p392 cumulative performance patch for rbenv

(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)

This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

Requirements

#!/usr/bin/env ruby
#
# Proof-of-Concept RCE exploit against Gemcutter
#
# ## Advisory
#
# ## Caveats
#
# ## Synopsis
#
install_package "yaml-0.1.4" "http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz#36c852831d02cf90508c29852361d01b"
install_git "ruby-1.9.3-p392-ref" "https://github.com/ConradIrwin/ruby.git" "find-references" autoconf standard verify_openssl
@Uroc327
Uroc327 / autoswap_wmctrl.vim
Last active January 1, 2016 10:49 — forked from dprelec/autoswap_linux.vim
This is a version of autoswap_mac.vim from Damian Conway's vim talk that works (or at least tries to) with wmctrl. This does not depend on any stupid titlestrings for vim. Instead it fetches the pid for the swap file and brings the associated window up.
" Vim global plugin for automatin response to swapfiles (from autoswap_mac.vim from Damian Conway)
" Last Change: 2013 Dec 25
" Maintainer: Constantin Runge <uroc327@cssbook.de>
" License: other
if exists("loaded_autoswap")
finish
endif
let loaded_autoswap = 1