PHP's array_intersect
throws a fit if you only pass in one array cause it's a whiney baby. This one is good.
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
window.location.href = `v-for-wiki://${window.location.host}${window.location.pathname}`; |
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
directive @all( | |
""" | |
Specify the class name of the model to use. | |
This is only needed when the default model resolution does not work. | |
""" | |
model: String | |
""" | |
Apply scopes to the underlying query. | |
""" |
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 | |
BASE03="\[\033[38;5;234m\]" | |
BASE02="\[\033[38;5;235m\]" | |
BASE01="\[\033[38;5;240m\]" | |
BASE00="\[\033[38;5;241m\]" | |
BASE0="\[\033[38;5;244m\]" | |
BASE1="\[\033[38;5;245m\]" | |
BASE2="\[\033[38;5;254m\]" | |
BASE3="\[\033[38;5;230m\]" |
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 | |
// One means "Assign this value to this variable" | |
$number = 1; // This one is an integer (whole number) | |
$anotherNumber = "1"; // This one is a string | |
// Two means "Are these the same value?" | |
if ($number == $anotherNumber) { | |
// This will be true | |
} |
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 | |
$myStarSign = "Gemini"; | |
if ($myStarSign == "Taurus") { | |
echo "Me too!"; | |
} elseif ($mystarsign == "nah") { | |
echo "your dumb!"; | |
} else { | |
echo "Too bad so sad..."; |
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 | |
/** | |
* Pass in a number and get it back as a string with an ordinal suffix (1 -> 1st, 2 -> 2nd etc) | |
*/ | |
function addSuffix($number) | |
{ | |
if ($number == 1) { | |
return $number + 'st'; | |
} elseif ($number == 2) { |
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 | |
//TODO get URL from parameters and authenticate it with an expiring hash/timestamp | |
$url = 'http://traffic.libsyn.com/atpfm/atp95.mp3'; | |
// Forward these headers from original request | |
$requestHeaders = []; | |
if (isset($_SERVER['HTTP_USER_AGENT'])) $requestHeaders[] = 'User-Agent: ' . $_SERVER['HTTP_USER_AGENT']; | |
if (isset($_SERVER['HTTP_RANGE'])) $requestHeaders[] = 'Range: ' . $_SERVER['HTTP_RANGE']; |
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 | |
# Fergus Staging Deploy Script | |
# Update git to staging | |
cd /var/www/fergus_internal_demo; | |
#!/bin/bash | |
function bgtext { | |
echo -e $(tput setab 24)" $1"$(tput sgr0); |
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 | |
public static function group_by(Array $objects, $group_by_property) | |
{ | |
$grouped_objects = []; | |
foreach($objects as $object) | |
{ | |
$property_value = $object->{$group_by_property}; | |
NewerOlder