Skip to content

Instantly share code, notes, and snippets.

@jrharshath
jrharshath / node-sass-import-resolver.js
Last active August 5, 2016 18:55
To be used with node-sass to import, inline and minify css from local sources, as well as from npm modules.
/**
* USAGE: Place this script in a directory named `build-tools` in the root of your project.
* Add node-sass to your project's dev-dependencies.
* Add an npm script "bundle-scss" with the following definition:
*
* node-sass main.scss output.css --importer ./build-tools/node-sass-import-resolver
*
* Supported imports:
*
* @import ('theme.css'); // will resolve css files locally
@jrharshath
jrharshath / validateInt64.js
Created April 25, 2016 20:54
Validate 64-bit integer (Int64) in Javascript
function validateInt46(value)
{
if (!/^[-]?\d+$/.test(value)) return false;
var isNegative = value[0]==='-';
if (value.length < 18 + (isNegative ? 1 : 0)) return true;
if (value.length > (isNegative ? 20 : 19)) return false;
if (isNegative) value = value.slice(1);