View parsequery.js
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
function parseQuery(str) { | |
var qso = {}; | |
var qs = (str || document.location.search); | |
// Check for an empty querystring | |
if (qs == "") { | |
return qso; | |
} | |
// Normalize the querystring | |
qs = qs.replace(/(^\?)/, '').replace(/;/g, '&'); | |
while (qs.indexOf("&&") != -1) { |
View dynamics.odata.services.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
<?php | |
// A pretty basic but effective class that can be used for doing CRUD operations on Microsoft Dynamics NAV's Odata services | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
class http_request { | |
protected $_handle = NULL; |
View helper.string.js
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 helper = {}; | |
helper.string = { | |
contains : function (haystack, needle) { | |
return !!~haystack.indexOf(needle); | |
}, | |
... | |
}; |
View contains.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
function contains($haystack, $needle, $caseSensitive = false) { | |
return $caseSensitive? | |
(strpos($haystack, $needle) === FALSE ? FALSE : TRUE): | |
(stripos($haystack, $needle) === FALSE ? FALSE : TRUE); | |
} | |
var_dump(contains('bare','are')); // Outputs : bool(true) | |
var_dump(contains('stare', 'are')); // Outputs : bool(true) | |
var_dump(contains('stare', 'Are')); // Outputs : bool(true) | |
var_dump(contains('stare', 'Are', true)); // Outputs : bool(false) |
View jquery.qsParameters.js
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
(function ( $ ) { | |
$.qsParameters = function(str) { | |
var qso = {}; | |
var qs = (str || document.location.search) | |
// Check for an empty querystring | |
if (qs == ""){ | |
return qso; | |
} | |
View eat-sleep-code-repeat.js
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
(function repeat() { | |
eat(); | |
sleep(); | |
code(); | |
repeat(); | |
})(); |
View selfdescriptive.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
<?php | |
// PHP implementation of my solution for James Grimes's puzzle @ https://www.youtube.com/watch?v=K6Qc4oK_HqY | |
// The following function calculates the (only) self descriptive number for any number of digits | |
// | |
// With "self descriptive number", I mean : | |
// ------------------- | |
// The first digit tells me how many zeros are in the number | |
// The second digit tells me how many ones are in the number | |
// The third digit tells me how many twos are in the number |
View __math.scss
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
// Some code is my own | |
// Some code is coming from https://github.com/adambom/Sass-Math/blob/master/math.scss | |
// Some code is coming from http://thesassway.com/advanced/inverse-trigonometric-functions-with-sass | |
// Some code coming from http://thesassway.com/advanced/math-sequences-with-sass | |
@function power($base, $exponent) { | |
$ret: 1; | |
@if $exponent > 0 { | |
@for $i from 1 through $exponent { | |
$ret: $ret * $base; |
View _generated-placeholders.scss
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
// This code will only work if you use Sass 3.3 (or higher) | |
// Configuration : | |
// ----------------------------------------- | |
$screensizes : ( | |
'default' : 0 infinity, | |
'mobile' : 0 767px, | |
'phone' : 0 480px, | |
'tablet' : 481px 767px, |
View superglobals.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
<?php | |
// Generate a formatted list with all superglobals | |
//---------------------------------------------------- | |
// Custom superglobal variable $_CUSTOM | |
$_CUSTOM = array('USERNAME' => 'john', 'USERID' => '18068416846'); | |
// List here whichever superglobals you want to print | |
// This could be your own custom superglobals | |
$globals = array( | |
'$_SERVER' => $_SERVER, '$_ENV' => $_ENV, |
NewerOlder