Skip to content

Instantly share code, notes, and snippets.

View tolu's full-sized avatar

Tobias Lundin tolu

  • Elate
  • Oslo, Norway
View GitHub Profile
@tolu
tolu / TeamCityNode.cmd
Last active May 20, 2016 23:44
TeamCity helper for Node-based commands (grunt, gulp for now)
:: https://gist.github.com/tolu/d867c4ef9581251b46dc
@echo off
:: Expects to be called with [command] [params*]
:: Where command is either "grunt" or "gulp"
:: File executes command and prints TeamCity separators
:: 1. Makes sure that global version of command is installed
:: 2. Calls npm install in current directory
:: 3. Calls command with provided [params]
:: 4. Prints time of execution
@tolu
tolu / saveAnyFileInLocalStorage
Last active August 29, 2015 14:10
Save any file in localStorage.
function fixAkamaiEOL(url, callback) {
// create XHR, Blob and FileReader
var xhr = new XMLHttpRequest();
var fileReader = new FileReader();
var blob;
xhr.open("GET", url, true);
// set responseType to arraybuffer
xhr.responseType = "arrayBuffer";
@tolu
tolu / module.js
Created August 17, 2014 13:58
JS module
(function (definition) {
// Turn off strict mode for this function so we can assign to global
/* jshint strict: false */
// This file will function properly as a <script> tag, or a module
// using CommonJS and NodeJS or RequireJS module formats. In
// Common/Node/RequireJS, the module exports the API and when
// executed as a simple <script>, it creates a global instead.
// Montage Require
@tolu
tolu / oneClickSetup
Last active September 13, 2016 07:54
One click install of chocolatey and a bunch of nice to have apps.
@echo off
::check if chocolatey is installed
set chocolateyDir=%systemdrive%\chocolatey
IF EXIST %chocolateyDir% goto already-installed
echo installing chocolatey...
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%chocolateyDir%\bin
:: refresh environment variables to be able to call