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
fastcgi_cache_path /tmp/nginx-cache levels=1:2 keys_zone=wordpress:20m inactive=1d max_size=512M; | |
upstream php-fpm { | |
server localhost:9000; | |
} | |
server { | |
listen 1.2.3.4:80; | |
listen [1:2:3:4::5]:80; | |
server_name blog.example.com |
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.AuthenticatedRoute = Ember.Route.extend | |
redirect: -> | |
controller = App.__container__.lookup('controller:user') | |
unless controller.get 'isSignedIn' | |
App.application.set('nextRoute', @routeName) | |
App.application.set('nextContext', @context) | |
@transitionTo 'index' # this is the login page | |
deserialize: (params) -> | |
context = @_super(params) |
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
#!/bin/bash | |
apt-get install ruby rubygems | |
gem1.8 install fpm --no-ri --no-rdoc | |
apt-get install build-essential openssl libreadline6 libreadline6-dev \ | |
zlib1g zlib1g-dev libssl-dev ncurses-dev libyaml-dev | |
wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.0-stable.tar.gz |
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
Add support for db evolutions: | |
Download the sqlite-dialect from here: https://github.com/gwenn/sqlite-dialect | |
Compile it to a jar file. | |
Add the jar file the app/lib folder. |
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
# db/migrate/XXXXXXXXXXXXX_add_authentication_token_to_users.rb | |
class AddAuthenticationTokenToUsers < ActiveRecord::Migration | |
def change | |
add_column :users, :authentication_token, :string | |
add_index :users, :authentication_token, :unique => true | |
end | |
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
# Goal: Allow addition of instances to a collection in a factory-built object | |
# when those instances require references to the parent. | |
# Typically occurs in Rails when one model has_many instances of another | |
# See more at: | |
# http://stackoverflow.com/questions/2937326/populating-an-association-with-children-in-factory-girl | |
# Usage | |
# Foo has_many :bar | |
# |
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 Basket < ActiveRecord::Base | |
has_many :fruits | |
def apples | |
fruits.where(type: 'Apple') | |
end | |
def oranges | |
fruits.where(type: 'Apple') | |
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
<?php | |
/* | |
* Implantation "made-in-OVH" de disk_free_space() | |
* ATTENTION : pensez à remplacer les arguments de | |
* $soap->login() avec votre propre identifiant et mot de passe. | |
* Vous devez aussi indiquer votre domaine dans $soap->hostingSummary(). | |
*/ | |
function ovh_free_space($path){ | |
$cache_file = "data/quotas.cache.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
function ls-refresh { | |
while [ 1 ]; do ls -hdl "$1"; echo -n -e "\033[1A"; sleep 1; done | |
} |
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
# Install ruby with RVM and Homebrew | |
$ xcode-select --install | |
$ gcc --version | |
$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)" | |
$ brew doctor | |
$ \curl -sSL https://get.rvm.io | bash -s stable --ruby | |
# Install PostgreSQL | |
$ brew install postgres | |
$ ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents |