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
--- | |
- name: install dependencies | |
apt: > | |
pkg={{ item }} | |
state=present | |
sudo: yes | |
with_items: | |
- libsqlite3-dev | |
- name: gem |
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 | |
### BEGIN INIT INFO | |
# Provides: xvfbd | |
# Required-Start: $local_fs $remote_fs $network $syslog | |
# Required-Stop: $local_fs $remote_fs $network $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: X Virtual Framebuffer | |
# Description: X Virtual Framebuffer | |
### END INIT INFO |
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
<snippet> | |
<content><![CDATA[ | |
<trans-unit> | |
<source>${1:Source}</source> | |
<target>${2:Target}</target> | |
</trans-unit> | |
]]></content> | |
<tabTrigger>transunit</tabTrigger> | |
<scope>text.xliff</scope> | |
</snippet> |
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 this repo to the /etc/apt/source.list file | |
deb ftp://ftp.debian.org/debian stable contrib non-free | |
# And run these commands | |
sudo apt-get update | |
sudo apt-get install ttf-mscorefonts-installer |
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
<snippet> | |
<content><![CDATA[ | |
/** | |
* Set ${1:property} | |
* | |
* @param ${2:type} \$$1 | |
* | |
* @return ${3:Type} | |
*/ | |
public function set${1/^([a-z])/\u$1/g}(\$$1) |
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 | |
$str = " Hello world | |
"; | |
echo trim($str, " \t\n\r\0\x0B"); // will echo "Hello World" |
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 | |
/** | |
* Transform a camel case string to an underscore string | |
* | |
* @param string $str | |
* @return string | |
*/ | |
public static function camelCaseToUnderscore($str) | |
{ |
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 | |
/** | |
* Elegant way to create an API URL | |
* | |
* Usage: | |
* $this->getResourceUrl('/product/%s/id-%d', 'edit', 13); | |
* // will produce http://domain.com/product/edit/id-13 | |
* | |
* // A resource can be an array to embed this method in an other method |
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
require 'rbconfig' | |
isWindows = /mswin|win|mingw|cygwin/i === RbConfig::CONFIG['host_os'] |
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
set :branch, "master" | |
task :set_branch_revision do | |
default_tag = `git tag`.split("\n").last | |
tag = Capistrano::CLI.ui.ask "Tag to deploy (make sure to push the tag first): [#{default_tag}] " | |
if tag.empty? | |
default_revision = `git log origin/#{branch} -n 1 --pretty=format:%H` | |
default_short_revision = default_revision[0, 10] | |
revision = Capistrano::CLI.ui.ask "Revision to deploy (on branch #{branch}): [#{default_short_revision}] " |