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 | |
define('BASE_HREF', '//' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/'); | |
?> | |
<base href="<?=BASE_HREF?>" /> |
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
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{SCRIPT_FILENAME} !-d | |
RewriteCond %{SCRIPT_FILENAME} !-f | |
RewriteRule ^.*$ ./index.php |
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
Array.shuffle = function(array) { | |
var tmp, current, top = array.length; | |
if(top) while(--top) { | |
current = Math.floor(Math.random() * (top + 1)); | |
tmp = array[current]; | |
array[current] = array[top]; | |
array[top] = tmp; | |
} |
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
// returns max value in array | |
Array.max = function(array) { | |
return Math.max.apply(Math, array); | |
} |
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
var hash = function(s){ | |
var n; | |
if (typeof(s) == 'number' && s === parseInt(s, 10)){ | |
s = Array(s + 1).join('x'); | |
} | |
return s.replace(/x/g, function(){ | |
var n = Math.round(Math.random() * 61) + 48; | |
n = n > 57 ? (n + 7 > 90 ? n + 13 : n + 7) : n; | |
return String.fromCharCode(n); | |
}); |
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
// save hash value for HTML5 browsers arriving to site via HTML4 hashed url | |
// this should be done before $(document).ready and History.js is loaded | |
window.initHash = window.location.hash; | |
$(document).ready(function() { | |
var baseURL = History.getBaseUrl(), | |
currentURL = History.getState().url, | |
relativeURL = currentURL.replace( baseURL, '' ); | |
if ( !Modernizr.history && currentURL !== baseURL ) { |
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 | |
$file = fopen( 'test.json', 'w' ) or die( 'Failed to open file' ); | |
$json = file_get_contents( 'php://input' ); | |
fwrite( $file, $json ) or header( 'HTTP/1.1 500 Internal Server Error' ); | |
fclose( $file ); | |
/* EOF */ |
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 | |
require_once 'lib/simplepie.inc'; | |
require_once 'lib/json_format.php'; | |
$response = array( | |
'tweets' => parse_feed( 'http://search.twitter.com/search.atom?q=from%3acnnbrk+OR+from%3anpratc' ) | |
); | |
function parse_feed( $url ) |
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
#### GIT #### | |
alias ga='git add' | |
alias gp='git push' | |
alias gl='git log' | |
alias gs='git status' | |
alias gd='git diff' | |
alias gdc='git diff --cached' | |
alias gm='git commit -m' | |
alias gma='git commit -am' | |
alias gb='git branch' |
OlderNewer