Skip to content

Instantly share code, notes, and snippets.

@stephenplusplus
stephenplusplus / app.js
Last active December 14, 2015 12:08
DI thing.
// Create a module for the application.
var app = things('taptap');
// A "Service" is a once-instantiated, injectable dependency your app may need.
// "User" is a service that will handle the functionality of logging in and out
// a user. Note that it lists "Store" in the signature of the function. This
// will be caught by "thing.js" and injected into the function when it is
// called.
app.service('User', function(Store) {
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
module.exports = function (grunt) {
// load all grunt tasks
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= pkg.name %> <%= pkg.version %>
'use strict';
var moment = require('moment');
var LIVERELOAD_PORT = 35729;
var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT});
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};
t. .X
: :
|.. .|
;|... ..|/
BXii||:.. .:||i8@
@Iiiiii;||:.. ..:||/iiiiii%
XIiiiiiiit;||:.. ..:||/iiiiiiiiIt
IIiiiiiiiiiiSt|:.. ..:|SSIiiiiiiiiiIt8
ttIiiiiiiiiiiItiiiiiiiiiiitiiiiiiiiiiitttt
@stephenplusplus
stephenplusplus / retry-failed-route.js
Created February 19, 2014 18:51
Angular API re-attempt
angular
.module('app')
.config(function ($httpProvider) {
$httpProvider.interceptors.push(['$injector', '$q', function ($injector, $q) {
return {
responseError: function (rejection) {
var $http = $injector.get('$http'),
$state = $injector.get('$state'),
MAX_RETRY_ATTEMPTS = 2,
request = rejection.config,
@stephenplusplus
stephenplusplus / byestyle.js
Last active August 29, 2015 14:00
remove inline styles from mean developers.
(function () {
[].slice.call(document.querySelectorAll('[style]')).
forEach(function (el) {
console.info(el.tagName.toLowerCase() + '.' + el.className);
console.log(el.getAttribute('style').split(/;\s*/g).join('\n'));
el.removeAttribute('style');
});
})();
@stephenplusplus
stephenplusplus / h5bp.js
Last active August 29, 2015 14:04 — forked from passy/h5bp.js
document.write("<!DOCTYPE html>");
document.write("<!--[if lt IE 7]> <html class=\"no-js lt-ie9 lt-ie8 lt-ie7\"> <![endif]-->");
document.write("<!--[if IE 7]> <html class=\"no-js lt-ie9 lt-ie8\"> <![endif]-->");
document.write("<!--[if IE 8]> <html class=\"no-js lt-ie9\"> <![endif]-->");
document.write("<!--[if gt IE 8]><!--> <html class=\"no-js\"> <!--<![endif]-->");
document.write(" <head>");
document.write(" <meta charset=\"utf-8\">");
document.write(" <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge,chrome=1\">");
document.write(" <title><\/title>");
document.write(" <meta name=\"description\" content=\"\">");
@stephenplusplus
stephenplusplus / p.cpp
Created September 28, 2014 01:25
saySomethingCute
void Daughter::saySomethingCute(unsigned short int whatThing) const {
std::string cuteThings[5] = {
"hiii dayud",
"a-woo!",
"mommm",
"geooo",
"bae"
};
if (whatThing > 4) {
whatThing = 0;
datastore
✓ should allocate IDs (691ms)
✓ should be able to save keys as a part of entity and query by key (1067ms)
create, retrieve and delete
✓ should save/get/delete with a key name (3964ms)
✓ should save/get/delete with a numeric key id (977ms)
✓ should save/get/delete with a generated key id (981ms)
✓ should save/get/delete multiple entities at once (1127ms)
querying the datastore
✓ should limit queries (985ms)