Skip to content

Instantly share code, notes, and snippets.

View Pilooz's full-sized avatar

Pierre-Gilles Levallois Pilooz

  • Freelancer
  • France
View GitHub Profile
@Pilooz
Pilooz / mirror.conf
Created March 9, 2016 10:00 — forked from ctrlaltdylan/mirror.conf
The nginx server configuration file needed to host the MirrorMirror application
server {
listen 80;
server_name localhost;
root /home/pi/projects/MirrorMirror/public;
index index.html index.htm index.php;
charset utf-8;
location / {
@Pilooz
Pilooz / pr.md
Last active August 29, 2015 14:23 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Pilooz
Pilooz / gist:5900307
Created July 1, 2013 12:13
guess mime type from filename extension
# Internal: Lookup mime type for extension.
#
# Returns a MIME::Type
def _mime_type
if defined? @_mime_type
@_mime_type
else
guesses = ::MIME::Types.type_for(extname.to_s)
# Prefer text mime types over binary
@Pilooz
Pilooz / gist:4275337
Created December 13, 2012 09:43
Rake Task for listing #TODO, #THINK and # FIXME in Ruby projects
desc "show a todolist from all the TODO tags in the source"
task :todo do
underyellow = "\e[4;33m%s\e[0m"
underred = "\e[4;31m%s\e[0m"
undergreen = "\e[4;32m%s\e[0m"
undercolor = ""
color = ""
Dir.glob('{ctrl,model,layout,view,spec}/**/*.{rb,xhtml}') do |file|
@Pilooz
Pilooz / gist:2959750
Created June 20, 2012 12:51
A better git log view
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
in the global config :
git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
@Pilooz
Pilooz / model_generator.rb
Last active October 3, 2015 15:37
Sequel model generator for mysql
# Sequel Basic Scafolding Model Generator for MySQL
# Requires sequel-3.34.0 and above.
#
# This routine takes all the table of a database, en generates all Sequel models
# For each table model we put :
# - A header that reminds you the table structure
# - the plugin list you wrote in 'plugin_to_add' array
# - The Sequel referential inegrity : one_to_many, many_to_one
# - A "Validate" method that checks not nullable columnns and unique columns
# - Generates init.rb to be include in the project