This file contains 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 "uri" | |
require "cgi" | |
class ApplicationHelper | |
def embedded_video(url, options = {}) | |
if url | |
# TODO: Handle other sources than Youtube video | |
params = CGI::parse(URI.parse(url).query || "") | |
if params["v"] | |
embedded_url = "//www.youtube.com/embed/#{params["v"].first}" |
This file contains 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
# app/services/minitest_rake_runner.rb | |
require 'open3' | |
class MinitestRakeRunner | |
attr_reader :stdout_lines | |
class RakefileMissingError < StandardError; end | |
PATTERN = /(?<tests>\d+) (tests|runs), (?<assertions>\d+) assertions, (?<failures>\d+) failures, (?<errors>\d+) errors, (?<skips>\d+) skips/ |
This file contains 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 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 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 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 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 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 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 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 |
OlderNewer