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
sed -i '' 's/DEFINER=`[^`][^`]*`@`[^`][^`]*`//g' filename.sql |
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
// Find the correct disk with diskutil | |
$ diskutil list | |
// Erase and format drive where "NAME" is the desired name (in capital letters) and "/dev/disk" is the target disk | |
$ sudo diskutil eraseDisk FAT32 NAME MBRFormat /dev/disk |
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 | |
Route::filter('auth.very_basic', function($request, $response) | |
{ | |
// Load configuration | |
$veryBasicAuthUser = 'admin'; | |
$veryBasicAuthPass = 'admin'; | |
$veryBasicAuthEnvs = array('dev'); | |
$veryBasicAuthMsg = 'Access denied'; | |
// Check if middleware is in use in current environment |
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
/** | |
* Retrieve an attribute value, or a default value, depending on if attribute is set | |
* @param string $attribute name of attribute | |
* @param mixed $default the default value | |
* @return mixed the attribute | |
*/ | |
public function attr($attribute, $default = null) | |
{ | |
if (isset($this->attributes[$attribute]) && $this->attributes[$attribute] != null) { | |
return $this->attributes[$attribute]; |
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
from urllib import urlopen | |
import json | |
data = urlopen('http://api.namnapi.se/v2/names.json?limit=10').read() | |
data = json.loads(data) | |
for name in data['names']: | |
print name['firstname'] | |
print name['surname'] | |
print name['gender'] |
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 | |
/** | |
* For caching routes | |
*/ | |
Route::filter('cache', function($route, $request, $response = null) { | |
$cacheTagKey = Config::get('values.cacheKeys.tags_routes'); | |
// Do not cache if the devcookie is set | |
if(Util::testDevCookie() == 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
add_shortcode('email', 'encodeEmail'); | |
function encodeEmail($attr) { | |
extract(shortcode_atts(array( | |
'adress' => 'nothing', | |
'text' => 'nothing', | |
), $attr)); | |
function encodeToEntity($str) { | |
$str = mb_convert_encoding($str , 'UTF-32', 'UTF-8'); | |
$t = unpack("N*", $str); |
NewerOlder