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 / 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.

@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 / 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 / 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 / install_homebrew.rb
Created February 22, 2012 15:26 — forked from mxcl/install_homebrew.markdown
Installs Homebrew to /usr/local so you don't need sudo to `brew install`
#!/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/mxcl/homebrew/tarball/master anywhere you like.
module Tty extend self
def blue; bold 34; end
def white; bold 39; end
def red; underline 31; end
def reset; escape 0; end
def bold n; escape "1;#{n}" end
@DAddYE
DAddYE / patch.rb
Created February 16, 2012 18:26
Postmark w/Padrino
# Add me in lib or somewhere
# lib/postmark_patch.rb
Mail::Message.class_eval do
def html?
content_type_without_symbol && content_type_without_symbol.include?('text/html')
end
end
@DAddYE
DAddYE / invalid.rb
Created January 20, 2012 22:58
Fix malformed ruby gemspec
#!/usr/bin/env ruby
#
# Usage: curl -sL https://raw.github.com/gist/1650084/invalid.rb | ruby
#
require 'open3'
stdin, stdout, stderr = Open3.popen3('gem check')
invalid = stderr.read
errors = invalid.scan(/\[(.+)\]:/).flatten
abort 'No errors in your gems specs' if errors.empty?
errors.each do |spec|
@DAddYE
DAddYE / pong.vim
Created January 15, 2012 20:55
Pong colorscheme for vim 256.
" Vim Color File
" Name: pong.vim
" Version: 0.1
" Maintainer: @DAddYE
"
" Based on bubblegum.
set background=dark
hi clear
@DAddYE
DAddYE / image_uploader.rb
Created December 30, 2011 22:57
CarrierWave on the fly resizer (work as dragonfly)
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::MiniMagick
storage :file
def thumb(size)
begun_at = Time.now
size.gsub!(/#/, '!')
uploader = Class.new(self.class)
uploader.versions.clear
uploader.version_names = [size]
@DAddYE
DAddYE / gist:1241981
Created September 26, 2011 10:22
CSS Coding rule

NEVER USE INLINE STILE!

An haml template like:

#content.padding{:style => "background:url(/images/middle.png) no-repeat top center #fff;"}

must be converted in css: