Skip to content

Instantly share code, notes, and snippets.

View jarod022's full-sized avatar

Cyril Farré jarod022

View GitHub Profile
@jarod022
jarod022 / gist:1640319
Created January 19, 2012 14:34
Méthode choose_layout (annule le layout si Ajax)
# dans application_controller
private
# Charge le layout qui porte le même nom que le Namespace
# retourne aucun layout si la requête est en AJAX
def choose_layout
namespace = self.class.name.split("::").first.downcase
(request.xhr?) ? nil : namespace
end
@jarod022
jarod022 / gist:1641868
Created January 19, 2012 19:06
GIT Color bashrc
# Show the current git branch
COLOR_RESET="\033[00m"
RED="\033[0;31m"
YELLOW="\033[0;33m"
GREEN="\033[0;32m"
PS1='[\u@\h \W$(__git_ps1 " (\[$YELLOW\]%s\[$COLOR_RESET\])")]\$ '
@jarod022
jarod022 / gist:1940207
Created February 29, 2012 11:29 — forked from gnepud/gist:1429965
Launch Pry in Rails project
# Launch Pry with access to the entire Rails stack.
# If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead.
# If you don't, you can load it through the lines below :)
rails = File.join Dir.getwd, 'config', 'environment.rb'
if File.exist?(rails) && ENV['SKIP_RAILS'].nil?
require rails
if Rails.version[0..0] == "2"
require 'console_app'
@jarod022
jarod022 / gist:1959360
Created March 2, 2012 16:08
Highlighting the current gutter for CordeMirror
function highlightingCurrentGutter(editor){
var $collection_pre = $(editor.getGutterElement()).find('pre');
$collection_pre.removeClass('active-gutter');
$($collection_pre[editor.getCursor().line]).addClass('active-gutter');
}
/* exemple d'utilisation */
html_editor = CodeMirror.fromTextArea(html_code, {
lineNumbers: true,
matchBrackets: true,
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private
@jarod022
jarod022 / Custom.css
Created May 8, 2012 08:25 — forked from curtisblackwell/Custom.css
Custom CSS - Chrome Developer Tools (another colors from IR_Black Theme)
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@jarod022
jarod022 / gist:2655119
Created May 10, 2012 18:56
Sleede - theme - Defaut style css
/* @autor : sleede SAS */
/* --------------------------------------------------
Table of Contents
-----------------------------------------------------
:: Base Styles
:: Shared Styles
:: Blocs & Misc
:: Header
:: Main
#Installation RVM + Ruby 2.0.0-p247 + Rails + nginx + Passenger sur CentOS
(avec sudo)
# Dépendance à installer :
sudo yum install git git-core curl curl-devel
# Création du groupe rvm (Il suffira d'ajouter les utilisateurs pouvants utiliser rvm à ce groupe)
sudo groupadd rvm
@jarod022
jarod022 / nginx
Created October 21, 2013 14:16 — forked from mustafaturan/nginx
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid