Skip to content

Instantly share code, notes, and snippets.

View hvanhonacker's full-sized avatar

Hugo hvanhonacker

  • Lille, France
View GitHub Profile
@r00k
r00k / q1.md
Last active January 29, 2017 03:00
Quizzy Question 1

Question 1

What object-oriented programming advice is this code violating?

def check_for_overheating(system_monitor)
  if system_monitor.temperature > 100
    system_monitor.sound_alarms
  end
end
@hanksudo
hanksudo / upgrading_postgresql.md
Last active February 11, 2019 17:36
(Ubuntu) Upgrade PostgreSQL from 9.1 to 9.4

Install PostgreSQL 9.4

echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >
          /etc/apt/sources.list.d/pgdg.list
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc 
          | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
@holman
holman / emoji_test.rb
Last active June 18, 2020 01:27
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
@dideler
dideler / upgrade-postgres-9.3-to-9.4.md
Last active June 8, 2020 03:24
Upgrading PostgreSQL from 9.3 to 9.4 when upgrading Ubuntu 14.04 to 14.10

TL;DR

Create a backup:

pg_dumpall > mybackup.sql

Perform the upgrade:

sudo pg_dropcluster 9.4 main --stop
@cserb
cserb / deploy.rb
Created June 3, 2014 16:20
queue_classic and capistrano
namespace :qc do
desc "start queue classic"
task :start do
run "nohup sh #{current_path}/qc_worker start > /dev/null 2>&1 &"
end
desc "stop queue classic"
task :stop do
run "sh #{current_path}/qc_worker stop"
end
@blt04
blt04 / Cucumber_JSON_Expanded_Formatter_README.md
Last active April 25, 2016 05:27
Cucumber JSON "expanded" formatter (expands Scenario Outlines)

Cucumber JSON Expanded formatter

This is similar to the built-in Cucumber JSON formatter except it expands scenario outlines so each row is reported with its result. Thus, scenario outlines appear similar to regular scenarios in the JSON output.

This supports regular mode and "--expand" mode. In both cases, scenario outline tables are expanded (however the underlying logic for doing the expansion varies greatly).

CREATE TEXT SEARCH CONFIGURATION fr ( COPY = french );
ALTER TEXT SEARCH CONFIGURATION fr ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, french_stem;
CREATE TEXT SEARCH CONFIGURATION en ( COPY = english );
ALTER TEXT SEARCH CONFIGURATION en ALTER MAPPING
FOR hword, hword_part, word WITH unaccent, english_stem;
CREATE TEXT SEARCH CONFIGURATION de ( COPY = german );
ALTER TEXT SEARCH CONFIGURATION de ALTER MAPPING
@wlangstroth
wlangstroth / deploy.rb
Last active September 11, 2021 13:15
Capistrano + Nginx + Unicorn + Sinatra on Ubuntu
require 'bundler/capistrano'
set :application, "net"
set :repository, "git@githost.com:net.git"
set :scm, :git
set :default_environment, {
'PATH' => "$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
}
@sfate
sfate / vim-on-heroku.sh
Created June 7, 2012 14:39 — forked from naaman/vim-on-heroku.sh
vim on heroku
#!/usr/bin/env bash
curl https://s3.amazonaws.com/heroku-jvm-buildpack-vi/vim-7.3.tar.gz --output vim.tar.gz
mkdir vim && tar xzvf vim.tar.gz -C vim
export PATH=$PATH:/app/vim/bin
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2: