Skip to content

Instantly share code, notes, and snippets.

View Florian95's full-sized avatar

Florian LAMACHE Florian95

View GitHub Profile
@Florian95
Florian95 / README.markdown
Last active August 29, 2015 14:01
ngSortable by Florian95
@codenamev
codenamev / grep search & replace
Created March 4, 2011 12:19
Search and replace a regex in multiple files on UNIX
egrep -lRZ "\.jpg|\.png|\.gif" . \
| xargs -0 -l sed -i -e 's/\.jpg\|\.gif\|\.png/.bmp/g'
#egrep: find matching lines using extended regular expressions
# -l: only list matching filenames
# -R: search recursively through all given directories
# -Z: use \0 as record separator
# "\.jpg|\.png|\.gif": match one of the strings ".jpg", ".gif" or ".png"
# .: start the search in the current directory
#xargs: execute a command with the stdin as argument
@sunny
sunny / application_helper.rb
Created July 25, 2012 17:21
li_nav : Utilitaire pour faire des liens dans des <li> qui appliquent des classe "current" automatiquement
# encoding: UTF-8
module ApplicationHelper
# Utilitaire pour faire un lien dans un li qui applique des classe "current"
# automatiquement.
#
# Arguments :
# - nom : nom du lien
# - url : chemin vers la page
@benoit-intrw
benoit-intrw / test_analyzer.sh
Created August 23, 2012 10:06
Elasticsearch: test analyser for text like 'R&D' or 'Canal+'
#!/bin/bash
# Script and configuration to test analyser
#
# Check arguments
hostname=$1
indexname=$2
if [ -z "$hostname" ] || [ -z "$indexname" ]
then
@visualmotive
visualmotive / experiment.py
Created October 12, 2012 18:16
Mixpanel API with A/B tests
#! /usr/bin/env python
#
# Mixpanel, Inc. -- http://mixpanel.com/
#
# Python API client library to consume mixpanel.com analytics data.
#
# Modified by Chris Mueller at Thumbtack for A/B tests
import hashlib
import urllib
@karmi
karmi / active_record_associations.rb
Created July 29, 2012 16:57
An example of elasticsearch & Tire setup for ActiveRecord associations
# An example of elasticsearch & Tire setup for ActiveRecord associations.
#
# A `Book has_many :chapters` scenario, with mapping and JSON serialization
# for indexing associated models.
#
# Demonstrates three important caveats as of now:
#
# 1. You you have to use `touch: true` in the `belongs_to` declaration,
# to automatically notify the parent model about the update.
#
@bkutil
bkutil / deploy.rb
Created December 4, 2011 22:22 — forked from andruby/deploy.rb
Start and Stop tasks for resque workers and resque scheduler with capistrano deploy hook (without God)
after "deploy:symlink", "deploy:restart_workers"
after "deploy:restart_workers", "deploy:restart_scheduler"
##
# Rake helper task.
# http://pastie.org/255489
# http://geminstallthat.wordpress.com/2008/01/27/rake-tasks-through-capistrano/
# http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/
def run_remote_rake(rake_cmd)
rake_args = ENV['RAKE_ARGS'].to_s.split(',')
@dz0ny
dz0ny / Capfile.rb
Created May 5, 2012 19:29
FTP Sync for Capistrano
load 'config/deploy'
desc "FTP Sync"
namespace :deploy do
desc "Sync and compile to remote by default"
task :default do
#assets.sprite
#assets.compile
remote.default
@terenceponce
terenceponce / README.md
Last active January 2, 2019 04:02
Setting up rbenv, Ruby 2.1, Rails 4.1.0.beta1, nginx, Passenger, PostgreSQL 9.1 on Ubuntu 12.04 LTS for Windows Azure

Setting up Ruby, Rails, Nginx, Passenger, PostgreSQL 9 on Ubuntu 12.04 LTS for Windows Azure

Last updated: 12/31/2013

Fix the locale issue

  • Edit /etc/default/locale as sudo.
  • Append LC_ALL="en_US.UTF-8" at the end of the file, save and quit.
  • sudo locale-gen en_US en_US.UTF-8
  • sudo dpkg-reconfigure locales

Install the necessary packages to install rbenv and build Ruby

@seahyc
seahyc / rancher-slack.js
Last active May 17, 2019 20:40
Listens to Rancher websocket events, and notify through slack webhook when application is upgraded
/*
Setup:
npm install ws
Usage:
Create an API key in Rancher and start up with:
node socket.js address.of.rancher:8080 access_key secret_key project_id
*/
var WebSocket = require('ws');