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
| <?php | |
| function date_range($start, $end, $format = 'Y-m-d') | |
| { | |
| $start = DateTime::createFromFormat($format, $start); | |
| // add 1 day to include last date | |
| $end = DateTime::createFromFormat($format, $end)->modify('+1 day'); | |
| $dates = new DatePeriod($start, new DateInterval("P1D"), $end); | |
| $range = array(); |
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
| <?php | |
| function convert($n) | |
| { | |
| $d = array( | |
| 0 =>'zero', 1 => 'one', 2 => 'two', 3=> 'three', 4=> 'four', 5 => 'five', 6=> 'six', 7=> 'seven', 8=> 'eight', 9=> 'nine', 10=> 'ten', | |
| 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14=>'fourteen', 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', | |
| 20 => 'twenty', 30 => 'thirty', 40 => 'fourty', 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', | |
| 100 => 'hundred', 1000 => 'thousand', 1000000 => 'million', 1000000000 => 'billion' | |
| ); |
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
| <?php | |
| $small = range('a', 'z'); | |
| $caps = range('A', 'Z'); | |
| $s = str_split('abcdef'); | |
| foreach($s as $o){ | |
| $c.= $caps[array_search($o, $small)]; | |
| } |
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
| find Music/ -iname '*.mp3' -exec cp {} ~/Music/ |
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 | |
| # | |
| livepath="/path/to/your/live" | |
| devpath="/path/to/your/dev" | |
| while read oldrev newrev ref | |
| do | |
| branch=`echo $ref | cut -d/ -f3` | |
| if [[ "master" == "$branch" ]]; then | |
| git --work-tree=$livepath checkout -f $branch | |
| echo 'Changes pushed live.' |
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
| <?php | |
| function test($string) | |
| { | |
| $alpha = range('A', 'Z'); | |
| $years = range(2013, 2012 + count($alpha)); | |
| $array = array_combine($years, $alpha); |
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
| <?php | |
| $timestamp = strtotime('next Sunday'); | |
| ?> | |
| <?php for ($i = 0; $i < 7; $i++) : ?> | |
| <?php $timestamp = strtotime('+1 day', $timestamp); ?> | |
| <option value="<?php echo strftime('%A', $timestamp); ?>"><?php echo strftime('%A', $timestamp); ?></option> | |
| <?php endfor; ?> |
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
| find -mindepth 1 -maxdepth 1 -type d -exec touch {}/file \; |
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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project name="" default="setup" basedir="."> | |
| <!-- Application setup --> | |
| <target name="setup"> | |
| <!-- Initialize git repo --> | |
| <exec executable="git" passthru="true" checkreturn="true" escape="false"> | |
| <arg value="init" /> | |
| </exec> | |
| <!-- Make the needed directories for the application --> |
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
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
OlderNewer