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 | |
function camel_case(string $s): string { | |
$items = explode(" ", $s); | |
$r = ""; | |
for ($i=0; $i<count($items); $i++){ | |
$r .= ucfirst(strtolower($items[$i])); | |
}//end i-for | |
return $r; | |
} |
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 | |
function count_smileys($arr): int { | |
$r = 0; | |
$l = count($arr); | |
$validEyes = [":", ";"]; | |
$validNoses = ["-", "~"]; | |
$validMouths = [")", "D"]; | |
for($i=0; $i<$l; $i++){ | |
$t = str_split( $arr[$i] ); | |
$onMouth = FALSE; |
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 | |
function getAllCombinations($in, $minLength = 1, $max = 2000) { | |
$count = count($in); | |
$members = pow(2, $count); | |
$ret = array(); | |
for($i=0; $i<$members; $i++){ | |
$b = sprintf("%0".$count."b", $i); //Build out binary representation | |
$out = []; | |
for($j=0; $j<$count; $j++){ | |
if($b{$j} === '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 | |
function anagrams(string $word, array $words, bool $isVerbose=FALSE): array { | |
// Your code here | |
$l1 = strlen($word); | |
$ret = []; | |
if( $isVerbose === TRUE ) | |
echo "WORD COUNT: " . $l1 . "\n"; | |
for ($i=0; $i<count($words); $i++){ | |
$cur = $words[$i]; | |
$isAppending = TRUE; |
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 | |
function likes( $names ) { | |
$l = count($names); | |
if ($l === 0) | |
return "no one likes this"; | |
else if ($l === 1) | |
return $names[0] . " likes this"; | |
else if ($l === 2){ | |
$r = $names[0] . " and " .$names[1]. " like this"; | |
return $r; |
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
#* * * * * /path/to/executable param1 param2 | |
# use /bin/sh to run commands, no matter what /etc/passwd says | |
SHELL=/bin/sh | |
# mail any output to `paul', no matter whose crontab this is | |
MAILTO=tannerleewoody | |
#Pacific Time (Oregon) | |
CRON_TZ=PDT | |
#Out file: | |
out=/tmp/cronOut.txt | |
bDir=/var/www/testdir/bash/scripts/ |
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
// Helper methods for dealing with phone numbers and phone related content (i.e. "tel:") | |
export default | |
{ | |
/** | |
* Display a phone number as a given format | |
* @param {String, Int} pnum - A Phone number | |
* @param {Int} displayCase - The desired formmatting pattern | |
* @return {String} - If good phone number, properly displayed phone number; Else, empty string; | |
*/ |
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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
""""""""""""""""""""""""""""""__VUNDLE CONFIG__"""""""""""""""""""""""""""""" | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins |
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
ad=/usr/local/bin/arcanist | |
if [ -f ~/.bashrc ]; then | |
source ~/.bashrc | |
fi | |
export PATH="$PATH:$ad/bin/" |
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/sh | |
#***************************************************************************# | |
#***************************************************************************# | |
# FIRST DAY INSTALLS # | |
#***************************************************************************# | |
#***************************************************************************# | |
pprint (){ | |
printf "############ ############ ############ ############ ############ ############\n" | |
true |
OlderNewer