Skip to content

Instantly share code, notes, and snippets.

View ushu's full-sized avatar

Aurélien Noce ushu

View GitHub Profile
@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: 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: 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: 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 / 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 / Dockerfile
Last active August 29, 2015 14:07
Simple Dockerfile with compilers/interpreters
FROM ubuntu:trusty
RUN apt-get update
# basic build tools
RUN apt-get install -y build-essential
# Ruby
RUN apt-get install -y ruby
@ushu
ushu / build.sh
Created October 16, 2014 16:01
Run a given program against an input
#!/bin/bash
cd /code
if [ -e code.c ]; then
gcc -o runner code.c || exit 1
cat input | runner
elif [ -e code.cpp ]; then
cat input | runner
elif [ -e code.rb ]; then
@ushu
ushu / code.rb
Created October 16, 2014 16:04
A dumb program that sums its input
input = STDIN.read.split("\n")
input.shift # skip first line
puts input.map { |x| Integer(x) }.inject(&:+)
@ushu
ushu / gist:5bb4ea0c4ef9a8299437
Created October 16, 2014 16:08
Another Dockerfile to run compiled program
FROM ubuntu:trusty
RUN apt-get update
# C/C++
RUN apt-get install -y build-essential
# Ruby
RUN apt-get install -y ruby
[
{
"Author": "MissHannahMinx",
"Title": "Japanese Word of The Day - Saikou 最高!",
"VideoUrl": "https://www.youtube.com/watch?v=3an7Nd_UJMQ",
"PlaceholderUrl": "https://i.ytimg.com/vi/LzOihTM-6SQ/mqdefault.jpg"
},
{
"Author": "MissHannahMinx",
"Title": "Japanese Word of the Day - TEENY TINY 小さい!",