Skip to content

Instantly share code, notes, and snippets.

@jdivock
jdivock / gist:7265284
Last active December 27, 2015 04:09
Knockout API - MOcean Ideally this will be put to use with some type of cascading router, with all required objects being created and rendered on page load, then being subsequently loaded and shown as their route is hit.
define([
'jquery',
'knockout',
'text!templates/orders/orderPlacements.html',
'bindings/orderPlacementsBindings'
], function($, ko, html, PlacementGrid) {
var Orders = function(params) {
// CONSTRUCTOR - START
// Potential router.js
define([
'jquery',
'knockout',
'router',
'models/Order',
'models/VendorPortal'
], function($, ko, router, Order, VendorPortal) {
var vendorPortal = new VendorPortal().render();
@jdivock
jdivock / jqAnimPort
Created January 29, 2014 01:45
just the jquery animate code ported from 1.8 . . . hacked up to be used on a project where we're forced to use 1.7.2
var elemdisplay = {
BODY: "block"
}, curCSS, iframe, iframeDoc, cssExpand = ["Top", "Right", "Bottom", "Left"],
core_pnum = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,
cssPrefixes = ["Webkit", "O", "Moz", "ms"],
rnumsplit = new RegExp("^(" + core_pnum + ")(.*)$", "i"),
rnumnonpx = new RegExp("^(" + core_pnum + ")(?!px)[a-z%]+$", "i"),
ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
rposition = /^(top|right|bottom|left)$/,
@jdivock
jdivock / gist:ecb86168ef7d11d2c436
Created May 14, 2014 21:46
Tooltip directive, some day I'll bring you back to life old friend
'use strict';
angular.module('app.sell').directive('tooltip', function() {
return {
restrict: 'EA',
transclude: true,
scope: {
text: '@'
},
@jdivock
jdivock / gist:0829ca8b22e57e559601
Last active August 29, 2015 14:06
ClojureScript scratch
;; Anything you type in here will be executed
;; immediately with the results shown on the
;; right.
( #(conj %1 %2 %3) {"foo" "bar"} {"zub" "bub"} { "hi" "there"} )
( (fn [yep stuff] (conj yep stuff)) {"foo" "bar"} {"zub" "bub"} )
( #(* 2 %) 5)
@jdivock
jdivock / gist:405cf2201ae2b53e439c
Created September 14, 2014 19:22
React POC of loading makes for EP
/** @jsx React.DOM */
/* jshint ignore:start */
var Step1 = React.createClass({
// transferPropsTo() will take any props passed to CheckLink
// and copy them to <a>
handleMakeChange: function(makeValue) {
this.setState({
makeValue: makeValue
@jdivock
jdivock / fuckingDates.js
Created September 27, 2014 19:15
date fuckery
var times = { "Schedule": {
"2014-09-27T00:00:00": [
16
],
"2014-09-28T00:00:00": [
8,
9,
10,
11,
14
@jdivock
jdivock / home.bundle.js
Last active August 29, 2015 14:08
webpack + ng-annotate
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
@jdivock
jdivock / pullall.sh
Created December 1, 2014 16:56
Git pullall
git config alias.pullall '!f(){ git pull "$@" && git submodule update --init --recursive; }; f'
@jdivock
jdivock / inheritance.js
Created December 7, 2014 12:35
inheritance example
// Code goes here
var Parent = function(foo1){
this.foo1 = foo1
}
Parent.prototype.derp = function(){
console.log('derp derp');
}