Skip to content

Instantly share code, notes, and snippets.

View francois-blanchard's full-sized avatar
😁

François Blanchard francois-blanchard

😁
View GitHub Profile
@francois-blanchard
francois-blanchard / script_test.rb
Last active August 29, 2015 14:01
Transform String (CamelCase) to symbol ruby
string = "nameLolApiTruc"
# "nameLolApiTruc"
string!.gsub(/([a-z\d])([A-Z])/,'\1_\2')
# "name_Lol_Api_Truc"
string.downcase.to_sym
# :name_lol_api_truc
# methods examples extend String and Hash class
class String
def to_symbol
@francois-blanchard
francois-blanchard / Gemfile
Last active August 29, 2015 14:02
Facebook omniauth rails
# Gemfile
gem 'omniauth'
gem 'omniauth-facebook'
@francois-blanchard
francois-blanchard / rake task arguments
Last active August 29, 2015 14:02
Pass argument to rake task in rails
$ rake my_task id=user.id
@francois-blanchard
francois-blanchard / 0_init.md
Created June 9, 2014 21:24
Start node.js with express and socket.io
@francois-blanchard
francois-blanchard / back.sh
Created June 10, 2014 08:46
Back to old commit already push
# search commit
$ git log
# go to commit
$ git reset --hard 176ez2z5...
# force push
$ git push origin your_branch -f
@francois-blanchard
francois-blanchard / parse.rb
Created June 12, 2014 08:18
Parse DateTime rails with correct timezone
> Time.zone
=> (GMT+01:00) Europe/Paris
> Time.zone.parse("07/06/2017 16:00").to_datetime
=> Wed, 07 Jun 2017 16:00:00 +0200
@francois-blanchard
francois-blanchard / deploy.rb
Created June 12, 2014 10:14
Méthode de déploiement Capistrano
set :application, "TEST"
# repo details
set :scm, :git
set :scm_username, "git_name"
set :repository, "git@github.com:git_name/repo_name.git"
set :branch, "master"
set :git_enable_submodules, 1
# main details
@francois-blanchard
francois-blanchard / rake.sh
Created July 10, 2014 08:23
Rails Rake command line
# listing all rake command
$ rake -P
# listing task
$ rake -T
@francois-blanchard
francois-blanchard / aws_command_line.sh
Last active August 29, 2015 14:03
AWS Commande Line
# Install OSX via pip
$ sudo easy_install pip
$ sudo pip install awscli
# AWS Configuration
$ mkdir ~/.aws/
$ touch config
# file : ~/.aws/config
#
@francois-blanchard
francois-blanchard / error_github_large_files_detected.sh
Last active August 29, 2015 14:04
Github error : Large files detected.
# Github error : Large files detected.
$ git push origin mon_repo
#=> Counting objects: 283, done.
# Delta compression using up to 8 threads.
# Compressing objects: 100% (125/125), done.
# Writing objects: 100% (183/183), 32.68 MiB | 79.00 KiB/s, done.
# Total 183 (delta 97), reused 109 (delta 55)
# remote: error: GH001: Large files detected.
# remote: error: Trace: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx