Skip to content

Instantly share code, notes, and snippets.

View pxwise's full-sized avatar
🌎
[object Object], NaN

Shawn Stedman pxwise

🌎
[object Object], NaN
View GitHub Profile
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
</head>
@lrobeson
lrobeson / Gruntfile.js
Created September 23, 2013 20:49
Grunt config file for Compass / Sass watch, sound notification, and LiveReload
// Configuring Grunt tasks:
// http://gruntjs.com/configuring-tasks
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Play sound: https://github.com/astronaughts/grunt-play
play: {
compasscomplete: {
file: '/System/Library/Sounds/purr.aiff'
@daveriedstra
daveriedstra / loadModules.ts
Last active January 13, 2017 23:51
A way to guess and load modules before bootstrapping angular
/**
This module exports one function, loadModules, which guesses then downloads the modules
which need to be loaded before bootstrapping the application. loadModules() returns an
array of Promises which can be waited on using Promise.all.
The guessing process can handle
- normal loader as route.loadChildren
- redirect as route.redirectTo
- nested lazy loaders using route.data.alsoLoad*
@Directive({
selector: '[universalAd],[universal-ad]'
})
class UniversalAd {
constructor(
@Attribute('id') public id: string,
public adRegistry: MyAdRegistry,
public elementRef: ElementRef,
public cdRef: ChangeDetectorRef) {
@1995eaton
1995eaton / xmlhttprequest.js
Last active February 16, 2018 04:13
node.js XMLHttpRequest
var XMLHttpRequest = function() {
var http = require('http'),
https = require('https');
var method, host, port, path, protocol,
request, xhr, callEventListeners,
statusCodes, syncFinished,
lastReadyState = 0,
listeners = ['readystatechange', 'abort', 'error', 'loadend', 'progress', 'load'],
/* global mapboxgl */
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import Immutable from 'immutable';
import { clickMap, setStyle } from '../actions/index';
import diffStyles from '../utilities/diff.js';
@brandonroberts
brandonroberts / async-ng-module-loader.ts
Last active April 26, 2019 12:40
Webpack Async NgModule Loader
import {Injectable, NgModuleFactory, NgModuleFactoryLoader, Compiler, Type} from '@angular/core';
class LoaderCallback {
constructor(public callback) {}
}
export let load: Type = (callback: Function) => {
return new LoaderCallback(callback);
};
<script>
window.Promise || document.write('<script src="https://unpkg.com/es6-promise@3.2.1/dist/es6-promise.min.js"><\/script>');
window.fetch || document.write('<script src="https://unpkg.com/whatwg-fetch@1.0.0/fetch.js"><\/script>');
</script>
@mattbaker
mattbaker / jsdomtest.js
Created December 22, 2011 20:40
Build a pie chart using d3.js and send the result to stdout
/* jsdomtest.js: Build a pie chart using d3.js and send the result to stdout
* Requires d3.js and d3.layout.js in same directory
* Requires pie.js from this gist: https://gist.github.com/1509145
* ex. node jsdomtest.js > pie.svg
*/
var jsdom = require('jsdom'),
scripts = ["file://"+__dirname+"/d3.min.js",
"file://"+__dirname+"/d3.layout.min.js",
"file://"+__dirname+"/pie.js"],
@ryanseys
ryanseys / kill-port.sh
Created May 24, 2015 19:44
Kill processes using a particular port
lsof -P | grep ':8080' | awk '{print $2}' | xargs kill -9