Skip to content

Instantly share code, notes, and snippets.

@jiverson
jiverson / gist:5b84b0d7b0c641fe82c7
Created October 6, 2015 01:20 — forked from masimplo/gist:324e77a2dd20fb4aa227
Decorating $http service to support url interpolation
function httpDecorator($delegate: ng.IHttpService) {
var $http = $delegate;
var wrapper = () => {
// interpolate the url
var config = arguments[0];
config.url = interpolateUrl(config.url, config.params, config.data);
return $http.apply($http, arguments);
};

Difference between Debounce and Throttle

Debounce

Debounce a function when you want it to execute only once after a defined interval of time. If the event occurs multiple times within the interval, the interval is reset each time.
Example A user is typing into an input field and you want to execute a function, such as a call to the server, only when the user stops typing for a certain interval, such as 500ms.

Throttle

@jiverson
jiverson / index.html
Created March 16, 2016 01:41 — forked from nategood/index.html
Image Data to SVG
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
html, body {
margin: 0; padding: 0;
}
@jiverson
jiverson / dataviz_venn.png
Created March 16, 2016 01:45 — forked from emeeks/dataviz_venn.png
Embed Image Data in SVG Elements
dataviz_venn.png
@jiverson
jiverson / destructuring.js
Created April 18, 2016 16:20 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => {
return [1, 2, 3];
@jiverson
jiverson / nvm_node_updater.sh
Created April 28, 2016 16:05 — forked from sidneys/nvm_node_updater.sh
Node & NPM Global Updater: Updates NodeJS, NPM and all global Packages to 'latest' in one step
#!/bin/sh
# NVM_NODE_UPDATER
# v1.0.1
#
# Makes keeping NVM-managed, global NodeJS installations up-to-date a breeze.
# First, the global NodeJS installation is updated to 'latest'.
# Second, all global NPM packages are migrated, then also updated to 'latest'.
# Requires the Node Version Manager (https://github.com/creationix/nvm).
#
@jiverson
jiverson / README.md
Created August 11, 2016 20:01 — forked from chrisjacob/README.md
Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Intro

Description: Setup GitHub Pages "gh-pages" branch and "master" branch as subfolders of a parent project folder ("grandmaster").

Author: Chris Jacob @_chrisjacob

Tutorial (Gist): https://gist.github.com/833223

The Result

@jiverson
jiverson / gh-pages-deploy.md
Created August 11, 2016 20:14 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@jiverson
jiverson / app-1.spec.ts
Created September 30, 2016 05:42 — forked from wkwiatek/app-1.spec.ts
Angular 2 test snippets for Angular final version. Codebase for https://developers.livechatinc.com/blog/category/programming/angular-2/
// App
import { Component } from '@angular/core';
@Component({
selector: 'app',
template: '<span>{{ sayHello() }}</span>',
})
export class App {
public name: string = 'John';
# vim:ft=zsh ts=2 sw=2 sts=2
#
# agnoster's Theme - https://gist.github.com/3712874
# A Powerline-inspired theme for ZSH
#
# # README
#
# In order for this theme to render correctly, you will need a
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
#