Skip to content

Instantly share code, notes, and snippets.

View DAddYE's full-sized avatar

Davide D'Agostino DAddYE

  • Endor Labs
  • San Francisco
View GitHub Profile
@DAddYE
DAddYE / slides.css
Created February 26, 2012 16:47
Base slide.js css
.slides{
position: relative;
}
.slidesPagination {
position: absolute;
margin-bottom: 10px;
bottom: 0px;
left: 50%;
@DAddYE
DAddYE / jrails.js
Created February 26, 2012 16:59
Old jrails adapter for old rails projects
/*
*
* jRails ajax extras
* version 0.1
* <[email protected]> | http://www.ennerchi.com
*
*/
(function($) {
$.extend( $.ajaxSettings, { accepts: { _default: "text/javascript, text/html, application/xml, text/xml, */*" }} );
@DAddYE
DAddYE / hack.sh
Created March 19, 2012 11:31
OSX For Hackers
#!/bin/sh
##
# This is a script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# Run in interactive mode with:
# $ sh -c "$(curl -sL https://raw.github.com/gist/2108403/hack.sh)"
#
# or run it without prompt questions:
@DAddYE
DAddYE / mountain-lion-brew-setup.markdown
Created March 20, 2012 12:55 — forked from myobie/mountain-lion-brew-setup.markdown
Get Mountain Lion and Homebrew to Be Happy

Get Mountain Lion and Homebrew to Be Happy

before all uninstall all previous version of xcode 4.4.

sudo uninstall-devtools –mode=all

All developers tools under xcode 4.4+ are self-contained into XCode.app, before 4.4. all stuff was installed into /Developers

This command cleanup a bit your env.

module EventMachine
def self.system3(cmd, *args, &cb)
cb ||= args.pop if args.last.is_a? Proc
init = args.pop if args.last.is_a? Proc
# merge remaining arguments into the command
cmd = ([cmd] + args.map{|a|a.to_s.dump}).join(' ')
new_stderr = $stderr.dup
@DAddYE
DAddYE / simple_fiber_concurrency.rb
Created November 26, 2012 19:55
Simple example of concurrency in Ruby with Fiber.
require "fiber"
f1 = Fiber.new do |f2|
while true
puts "A"
sleep 2
f2.transfer
end
end
#!/usr/bin/env ruby
if ARGV[0]
signal =
case ARGV[0]
when 'wait' then :USR1
when 'restart' then :USR2
end
Process.kill(signal, ARGV[1].to_i)
@DAddYE
DAddYE / application_controller.rb
Created January 2, 2013 19:02
Performance tips for rails
class ApplicationController < ActionController::Base
around_filter :disable_gc
private
def disable_gc
GC.disable
begin
yield
ensure
module Async
class Queue
attr_reader :worker, :concurrency
attr_accessor :saturated,
:drain
def initialize(concurrency, &block)
@worker = block
@workers = 0
@concurrency = concurrency
export CONFIGURE_OPTS="\
--disable-install-doc \
--with-readline-dir=$(brew --prefix readline) \
--with-openssl-dir=$(brew --prefix openssl)
--with-yaml-dir=$(brew --prefix yaml) \
--with-gdbm-dir=$(brew --prefix gdbm) \
--with-libffi-dir=$(brew --prefix libffi)"