This file contains hidden or 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
| $str = "key1=value1&key2=value2&key2=value3&key3=value4"; | |
| $params = explode("&", $str); | |
| $output = array(); | |
| foreach ($params as $param){ | |
| $param = explode("=", $param); | |
| $key = $param[0]; |
This file contains hidden or 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
| typedef struct node { | |
| int key; | |
| struct node *left; | |
| struct node *right; | |
| } node; | |
| int is_odd(node *n){ | |
| // verify the root key | |
| if (n->key % 2 != 0) | |
| return 1; |
This file contains hidden or 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 | |
| # install libs | |
| apt-get install apache2 php5 libapache2-mod-php5 php5-dev | |
| apt-get install gearman-job-server libgearman-dev | |
| apt-get install php-pear | |
| pecl install gearman-1.0.3 | |
| # activate Gearman extension for Apache2 | |
| echo "extension=gearman.so" > /etc/php5/conf.d/gearman.ini |
This file contains hidden or 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 | |
| cd `brew --prefix` | |
| git checkout master | |
| git ls-files -z | pbcopy | |
| rm -rf Cellar | |
| bin/brew prune | |
| pbpaste | xargs -0 rm | |
| rm -r Library/Homebrew Library/Aliases Library/Formula Library/Contributions | |
| test -d Library/LinkedKegs && rm -r Library/LinkedKegs | |
| rmdir -p bin Library share/man/man1 2> /dev/null |
This file contains hidden or 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
| #include <ctype.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <unistd.h> | |
| int | |
| main (int argc, char **argv) | |
| { | |
| int aflag = 0; | |
| int bflag = 0; |
This file contains hidden or 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 | |
| echo "Sync files" | |
| echo "------------------------------------" | |
| if [ "$1" = "" || $2 = "" ]; then | |
| echo "Source/Dest path can not be null" | |
| exit | |
| fi |
This file contains hidden or 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 | |
| source ~/.git-completion.bash | |
| source ~/.git-prompt.sh | |
| MAGENTA="\[\033[0;35m\]" | |
| YELLOW="\[\033[0;33m\]" | |
| BLUE="\[\033[34m\]" | |
| LIGHT_GRAY="\[\033[0;37m\]" | |
| CYAN="\[\033[0;36m\]" |
This file contains hidden or 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 'mina/bundler' | |
| require 'mina/rails' | |
| require 'mina/git' | |
| require 'mina/rvm' | |
| # Usually mina focuses on deploying to one host and the deploy options are therefore simple. | |
| # In our case, there is a number of possible servers to deploy to, it is therefore necessary to | |
| # specify the host that we are targeting. | |
| server = ENV['server'] | |
| # Since the same host can have multiple applications running in parallel, it is necessary to |
This file contains hidden or 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
| - Check rails version | |
| $ rails -v | |
| - To update rails | |
| $ gem update rails | |
| - Creating a new rails app using postgresql | |
| $ mkdir rails_projects | |
| $ cd rails_projects | |
| $ rails new myapp --database=postgresql |
OlderNewer