Skip to content

Instantly share code, notes, and snippets.

View jslegers's full-sized avatar

John Slegers jslegers

View GitHub Profile
@jslegers
jslegers / jquery.qsParameters.js
Created February 21, 2016 17:24 — forked from EldonMcGuinness/jquery.qsParameters.js
JQuery Querystring Parser
(function ( $ ) {
$.qsParameters = function(str) {
var qso = {};
var qs = (str || document.location.search)
// Check for an empty querystring
if (qs == ""){
return qso;
}
@jslegers
jslegers / selfdescriptive.php
Last active January 8, 2016 04:19
self descriptive number
<?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
/*
Scoped Media Query Mixins - an element query workaround.
@mixin respond-to-all : generates @media () {}
@mixin respond-to-screen : generates @media screen and () {}
@mixin respond-to-screen-only : generates @media screen only and () {}
Accepts the following input :
// 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;
@jslegers
jslegers / superglobals.php
Last active August 29, 2015 13:56
Create a formatted list of all superglobals
<?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,