Skip to content

Instantly share code, notes, and snippets.

View ushu's full-sized avatar

Aurélien Noce ushu

View GitHub Profile
@ushu
ushu / install.sh
Last active January 4, 2016 08:48
very basic script to install mac box for non devs
#!/usr/bin/env bash
# ask from install for xcode
if ! pkgutil --pkg-info=com.apple.pkg.CLTools_Executables >/dev/null; then
echo "Choisir \"Installer\" à droite puis attendre la fin de l'installation"
xcode-select --install
echo
read -p "Click to continue when xcode command line tools have been installed..."
echo
fi
@ushu
ushu / Rails: Gemfile (more complete version)
Created December 5, 2013 16:32
Rails: Gemfile (more complete version)
source 'https://rubygems.org'
gem 'rails', '4.0.2'
# db
gem 'sqlite3', group: %i{development test}
#gem 'pg', group: :production # for heroku
# css
gem 'sass-rails', '~> 4.0.0'
@ushu
ushu / Rails: Basic Gemfile
Last active December 30, 2015 09:19
Rails: very basic Gemfile for starting a project
source 'https://rubygems.org'
gem 'rails', '4.0.2'
# db
gem 'sqlite3'
# css
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
@ushu
ushu / Rails: database_cleaner with rspec
Last active December 30, 2015 09:19
Rails: database_cleaner with rspec
# in spec/spec_helper
require 'database_cleaner'
# ...
RSpec.configure do |config|
config.before(:suite) do
DatabaseCleaner.strategy = :transaction
@ushu
ushu / Rails: disable rspec generators
Created December 5, 2013 16:12
Disable rspec generators
# in config/application.rb
config.generators do |g|
g.test_framework :rspec, fixture_replacement: :factory_girl
g.fixture false
g.view_specs false
g.helper_specs false
g.controller_specs false
g.routing_specs false
g.factory_girl false
@ushu
ushu / Rails: SendGrid initializer
Last active December 28, 2015 10:08
Rails: SendGrid settings
# config/initializers/sendgrid.rb
ActionMailer::Base.smtp_settings = {
:user_name => ENV['SENDGRID_USER'],
:password => ENV['SENDGRID_PASSWORD'],
:domain => 'herokuapp.com',
:address => 'smtp.sendgrid.net',
:port => 587,
:authentication => :plain,
:enable_starttls_auto => true
}
@ushu
ushu / Rails: DevelopmentMailInterceptor
Last active December 28, 2015 10:08
Rails mailer interceptor for DEV
# lib/development_mail_interceptor.rb
# copied from some RailsCast (could not remember the #...)
# expects a DEVELOPMENT_REDIRECT_EMAIL env var
class DevelopmentMailInterceptor
def self.delivering_email(message)
message.subject = "#{message.to} #{message.subject}"
message.to = ENV['DEVELOPMENT_REDIRECT_EMAIL']
end
end
@ushu
ushu / Cucumber: test omniauth login
Last active December 27, 2015 09:39
tags for omniauth: @fake_google_user etc.
Feature: Authentication
@fake_facebook_user
Scenario: I log in with my facebook account
Given I just arrived to the Website
And I log in using facebook
Then I see the Home Page
@ushu
ushu / S3 buckets copy.md
Created October 29, 2013 16:12
Copy between S3 buckets w/ different accounts

This is a mix between two sources:

basically the first resource is great but didn't work for me: I had to remove the trailing "/*" in the resource string to make it work. I also noticed that setting the policy on the source bucket was sufficient. In the end these are the exact steps I followed to copy data between two buckets on two accounts

Basically the idea there is:

  • we allowe the destination account to read the source bucket (in the console for the source account)
  • we log as the destination and start the copy
@ushu
ushu / main.cc
Created October 28, 2013 10:39
UVA basic
#include <iostream>
#include <string>
std::string compute(std:string in) {
return "";
}
int main() {
while(true) {
std::string input;