This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # What is your GitHub username? & your project name? Change with your own | |
| GITHUB_USERNAME="ssaunier" | |
| PROJECT_NAME="minesweep" | |
| # We can create GitHub repo from the terminal, with https://github.com/github/hub | |
| # It's really convinient. You can download it with: | |
| brew install hub | |
| # Say you want to work on a minesweep, create the repo: | |
| mkdir -p ~/code/$GITHUB_USERNAME/$PROJECT_NAME && cd $_ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| body { | |
| font-size: 16px; | |
| } | |
| .wufoo li.focused { | |
| background: none; | |
| } | |
| .wufoo input.text, .wufoo textarea.textarea { | |
| background: none !important; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'yaml' | |
| require "octokit" | |
| client = Octokit::Client.new :access_token => `cat ~/.gist` | |
| results = {} | |
| # Cities from http://fr.wikipedia.org/wiki/Liste_des_communes_de_France_les_plus_peupl%C3%A9es | |
| cities = File.readlines("cities.txt") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Like < ActiveRecord::Base | |
| belongs_to :user | |
| belongs_to :postcard | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| EMAIL_PATTERN = /([^\.@]+)(\.([^@]+))?@([^@]+)/ | |
| def parse_email(email) | |
| groups = EMAIL_PATTERN.match(email) | |
| if groups.nil? | |
| raise ArgumentError.new("'#{email}' is not a valid email address") | |
| else | |
| firstname = groups[1] | |
| lastname = groups[3] | |
| email_domain = groups[4] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| subl_path=`alias subl | grep -o '\(/[a-zA-Z0-9. ]\+\)\+'` | |
| git config --global core.editor "'$subl_path' -n -w" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Cat | |
| def initialize(name, color) | |
| @name = name | |
| @color = color | |
| @alive = true | |
| @color_history = [ color ] | |
| end | |
| attr_reader :name, :color, :color_history |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative "task_repository" | |
| require_relative "display" | |
| require_relative "controller" | |
| # Creer fausse base de données | |
| task_repository = TaskRepository.new | |
| # Creer un Display | |
| display = Display.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Fixnum | |
| def +(other) | |
| self * other | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| namespace :db do | |
| desc "Backs up heroku database and restores it locally." | |
| task import_from_heroku: [ :environment, :create ] do | |
| HEROKU_APP_NAME = nil # Change this if app name is not picked up by `heroku` git remote. | |
| c = Rails.configuration.database_configuration[Rails.env] | |
| heroku_app_flag = HEROKU_APP_NAME ? " --app #{HEROKU_APP_NAME}" : nil | |
| Bundler.with_clean_env do | |
| puts "[1/4] Capturing backup on Heroku" | |
| `heroku pg:backups capture DATABASE_URL#{heroku_app_flag}` |