Skip to content

Instantly share code, notes, and snippets.

View jstott's full-sized avatar

Jim Stott jstott

View GitHub Profile
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@spartDev
spartDev / gulpfile.js
Last active March 15, 2020 14:09
Gulp config
/*---------- Declare gulp variables ----------*/
var gulp = require('gulp'),
jshint = require('gulp-jshint'),
csslint = require('gulp-csslint'),
compass = require('gulp-compass'),
connect = require('gulp-connect'), path = require('path'),
livereload = require('gulp-livereload'),
clean = require('gulp-clean'),
@andrewconnell
andrewconnell / SharePoint 2013 SPA UX Template - Header
Created February 18, 2014 10:56
HTML template of the header for used to create a SharePoint 2013 Hosted App (SPH) Single Page App (SPA).
<div id="s4-titlerow" class="ms-dialogHidden" style="display:block;">
<div id="titleAreaBox" class="ms-noList ms-table ms-core-tableNoSpace">
<div id="titleAreaRow" class="ms-tableRow">
<div id="siteIcon" class="ms-tableCell ms-verticalAlignTop" style="width:180px;">
app logo goes here
</div>
<div class="ms-breadcrumb-box ms-tableCell ms-verticalAlignTop">
<div class="ms-breadcrumb-top">
<div class="ms-breadcrumb-dropdownBox" style="display:none;">
<span id="DeltaBreadcrumbDropdown"></span>
@idosela
idosela / http-response-interceptor.js
Last active February 25, 2024 12:51
Sample code for ng-conf 2014
angular.module('myMdl', []).config(['$httpProvider', function($httpProvider) {
$httpProvider.responseInterceptors.push([
'$q', '$templateCache', 'activeProfile',
function($q, $templateCache, activeProfile) {
// Keep track which HTML templates have already been modified.
var modifiedTemplates = {};
// Tests if there are any keep/omit attributes.
var HAS_FLAGS_EXP = /data-(keep|omit)/;
@CallumVass
CallumVass / gist:8300400
Last active January 2, 2016 11:59
Hacky way to load the correct service for before/after save operations to provide additional validation / business logic to entities for Breeze JS
public class SalesAppContextProvider : EFContextProvider<SalesAppContext>
{
private readonly ServiceFactory _serviceFactory;
public SalesAppContextProvider(ServiceFactory serviceFactory)
{
_serviceFactory = serviceFactory;
}
protected override bool BeforeSaveEntity(EntityInfo entityInfo)
@justindarc
justindarc / angular-snap.js
Last active December 17, 2015 14:19
AngularJS Directive for Snap.js
angular.module('angular-snap', [])
.directive('snap', function() {
var parseBoolean = function(attrValue, defaultValue) {
var strValue = '' + attrValue;
if (strValue === 'true' ||
strValue === 'yes' ||
strValue === '1') return true;
if (strValue === 'false' ||
@mkuklis
mkuklis / gist:3985606
Created October 31, 2012 07:27
scalable socket.io with redis and node-http-proxy
// balancer node
var httpProxy = require('http-proxy');
var uuid = require('node-uuid');
var Cookies = require('cookies');
var redis = require('redis');
var connect = require('connect');
var express = require('express');
var RedisStore = require('connect-redis')(express);
var redisClient = redis.createClient();
var port = 8000;
@iamkvein
iamkvein / hook_method.js
Created March 9, 2012 14:32
Improved way of temporarily replacing a method on an object
var install_hook_to = function(obj) {
if (obj.hook || obj.unhook) {
throw new Error('Object already has properties hook and/or unhook');
}
obj.hook = function(_meth_name, _fn, _is_async) {
var self = this,
meth_ref;