This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function update(path, val, obj) { | |
| (function r(keys, o) { | |
| if (keys.length > 1) { | |
| var current = keys.shift(); | |
| if (!o[current]) | |
| o[current] = isNaN(parseInt(keys[0])) ? {} : []; | |
| r(keys, o[current]); | |
| } else { | |
| o[keys[0]] = val; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (odds lis) | |
| (reverse (odds-reduce lis '()))) | |
| (define (odds-reduce l1 l2) | |
| (cond | |
| ((null? l1) l2) | |
| ((= (length l1) 1) (cons (car l1) l2)) | |
| (else (odds-reduce (cddr l1) (cons (car l1) l2))) | |
| )) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define (pop lis) | |
| (define (r a b) | |
| (if (= (length b) 1) | |
| a | |
| (r (cons a (car b)) (cdr b)) | |
| )) | |
| (cond | |
| ((NULL? lis) '()) | |
| ((= (length lis) 1) '()) | |
| (else (r (car lis) (cdr lis))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| var GoSquared = {}; | |
| GoSquared.acct = "GSN-889229-P"; | |
| (function(w){ | |
| function gs(){ | |
| w._gstc_lt = +new Date; | |
| var d = document, g = d.createElement("script"); | |
| g.type = "text/javascript"; | |
| g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js"; | |
| var s = d.getElementsByTagName("script")[0]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.AttributeSearchResultView = Backbone.View.extend({ | |
| tagName: 'li', | |
| events: { | |
| 'click': 'addAttribute' | |
| }, | |
| addAttribtue: function() { | |
| console.log('added'); | |
| }, | |
| initialize: function() { | |
| this.template = _.template($('#attributeSearchResult-template').html()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var fs = require('fs'); | |
| var casper = require('./util/augment/extend')(require('./util/augment/config')(require('casper').create({ | |
| clientScripts: ['includes/jquery-2.0.1.min.js'], | |
| pageSettings: { | |
| loadPlugins: false | |
| } | |
| }))); | |
| var mans = require('./mans'); | |
| var keys = Object.keys(mans); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var casper = require('./util/augment/extend')(require('casper').create({})); | |
| var fs = require('fs'); | |
| var check = require('./util/check'); | |
| var sumIn = require('../mans/util/sumIn'); | |
| casper.start(); | |
| var n = 0; | |
| var mans; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { "manID":"842", | |
| "manName":"3M", | |
| "name":"3M", | |
| "url":"http://www.orsnasco.com/storefrontB2BWEB/customauth/processSetMan.jsp?manId=842&manname=3M", | |
| "products": { | |
| "Welding Supplies": { | |
| "name":"Welding Supplies", | |
| "url":"http://www.orsnasco.com/storefrontB2BWEB/customauth/prodCategory.jsp?catId=265&catname=Welding+Supplies", | |
| "products": { | |
| "Welding Supplies Other": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isObject(o) { | |
| return o instanceof Object && o.constructor === Object; | |
| } | |
| function getNumberLeft (man) { | |
| var sum = 0; | |
| var keys = Object.keys(man.products); | |
| keys.forEach(function(key) { | |
| var keys2 = Object.keys(man.products[key].products); | |
| keys2.forEach(function(key2, i) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function foo() { | |
| var things; | |
| casper.thenOpen(url, function() { | |
| things = casper.evaluate(function() { | |
| var things = []; | |
| $('.alphabody a').each(function() { | |
| things.push($(this).text()); | |
| }); | |
| return things; | |
| }); |