Skip to content

Instantly share code, notes, and snippets.

View anasnakawa's full-sized avatar
💭
I may be slow to respond.

Anas Nakawa anasnakawa

💭
I may be slow to respond.
View GitHub Profile
@StfBauer
StfBauer / __themeState__.json
Last active July 16, 2022 22:19
Theme slots in Office UI Fabric taken from __themeState__.themes
// Default theme slots of Office theme
{
"backgroundOverlay": null,
"primaryBackground": null,
"primaryText": null,
"themeDarker": "#013a76",
"themeDark": "#0156b0",
"themeDarkAlt": "#0156b0",
"themePrimary": "#0273eb",
"themeSecondary": "#5dabfe",
<script type="text/javascript">
(function() {
'use strict';
/**
* hook method to be executed as soon as shortpoint
* is available in the page
*/
function initHook() {
@loklaan
loklaan / README.md
Last active January 12, 2019 13:58
Knockout + React

Knockout & React, in harmony

Bless

@paulirish
paulirish / bling.js
Last active April 20, 2024 17:39
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
}
NodeList.prototype.__proto__ = Array.prototype;
@rosskevin
rosskevin / Rakefile
Last active October 28, 2015 10:41
Rakefile - less to sass a.k.a. less2sass or less2scss
# less to scss based on http://stackoverflow.com/a/19167099/2363935
namespace :convert do
task :less_to_scss do
source_glob = "assets/less/*.less"
dest_dir = "converted"
rm_r dest_dir rescue nil
mkdir_p(dest_dir)
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@paulrouget
paulrouget / ff.md
Last active November 21, 2021 21:13
Hacking Firefox
@whatnickcodes
whatnickcodes / base64.js
Created April 24, 2014 15:01
How to Encode and Decode Strings with Base64 in JavaScript
// Create Base64 Object
var Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var n,r,i,s,o,u,a;var f=0;e=Base64._utf8_encode(e);while(f<e.length){n=e.charCodeAt(f++);r=e.charCodeAt(f++);i=e.charCodeAt(f++);s=n>>2;o=(n&3)<<4|r>>4;u=(r&15)<<2|i>>6;a=i&63;if(isNaN(r)){u=a=64}else if(isNaN(i)){a=64}t=t+this._keyStr.charAt(s)+this._keyStr.charAt(o)+this._keyStr.charAt(u)+this._keyStr.charAt(a)}return t},decode:function(e){var t="";var n,r,i;var s,o,u,a;var f=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(f<e.length){s=this._keyStr.indexOf(e.charAt(f++));o=this._keyStr.indexOf(e.charAt(f++));u=this._keyStr.indexOf(e.charAt(f++));a=this._keyStr.indexOf(e.charAt(f++));n=s<<2|o>>4;r=(o&15)<<4|u>>2;i=(u&3)<<6|a;t=t+String.fromCharCode(n);if(u!=64){t=t+String.fromCharCode(r)}if(a!=64){t=t+String.fromCharCode(i)}}t=Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r
@anasnakawa
anasnakawa / constant.js
Last active August 29, 2015 14:00
mocking constant behaviour using `Object.defineProperty`, works on real browsers & IE9+
/**
* simulating constant behaviour where
* given value cannot be changed
*
* @param {object} target object where the constant will be defined
* @param {string} key
* @param {object} value
* @return {object} constant
*
* example
@anasnakawa
anasnakawa / native-string-templates.js
Last active August 29, 2015 13:58
because i don't like string concatination
/**
* string parser with data passed as arguments
*
* @param {arguments}
* @return {string}
*
* example:
* --------
* 'i used both [0] & [1], however [1] looks good so far'.parse( 'iphone', 'andoird' ); // "i used both iphone & andoird, however andoird looks good so far"
* 'the weather now in [0] seems to be [1]'.parse( 'Dubai', function() { return 'very hot'; }); // "the weather now in Dubai seems to be very hot"