Skip to content

Instantly share code, notes, and snippets.

View jabranr's full-sized avatar
🚀
Building ideas

Jabran Rafique jabranr

🚀
Building ideas
View GitHub Profile
@jabranr
jabranr / decimal2binary.php
Last active February 25, 2016 18:36
Converts the integer to binary and outputs list of integers that are power of 2 (http://jabran.me/using-special-integers-with-bitwise-operators-for-php-rbac/)
<?php
/**
* Converts the integer to binary and outputs list of integers that are power of 2
*
* @author: Jabran Rafique <hello@jabran.me>
* @param: integer $decimal
* @return: string
*/
function get_special_binary( $decimal ) {
module.exports = function(grunt) {
grunt.initConfig({
sass: {
compile: {
options: {
style: 'compressed'
},
files: {
'styles/screen.css': 'styles/screen.scss'
@jabranr
jabranr / vanilla-javascript-bootstrap.js
Last active December 2, 2015 16:49
Vanilla JavaScript Bootstrap
/**
* This is small, light weight vanilla JavaScript Bootstrap script.
*
* It comes handy in situations where a framework i.e. jQuery is used only
* for "load" and "ready" events etc. This small script will not only save
* lot of bytes but also gives a basic start on writing object literal JavaScript.
*
* Learn more about object literal JavaScript at following resource:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Values,_variables,_and_literals
*
@jabranr
jabranr / custom-callback-with-google-maps-loading-flow.js
Last active August 29, 2015 14:05
Custom callback with Google Maps loading flow
// setup
!(function(root) {
var AsyncGoogleMap = (function() {
// constructor
function AsyncGoogleMap(canvas, lat, lng, zoom, callback) {
if ( typeof canvas === 'undefined' )
@jabranr
jabranr / basic-facebook-login-flow.js
Last active August 29, 2015 14:05
Basic Facebook login and data retrieval flow
// Check and verify user status or prompt for authorization
function checkUserStatus(response) {
var permissions = {
scope: '' // email
};
if ( isConnectedUser(response) )
return FB.api('/me', gotUserInfo);
return FB.login(checkUserStatus, permissions);
}