Skip to content

Instantly share code, notes, and snippets.

View jbeard4's full-sized avatar

Jacob Beard jbeard4

View GitHub Profile
@jbeard4
jbeard4 / Zotera.vb
Created February 9, 2013 23:42
Zotero.dot
Option Explicit
Private Const CP_UTF8 = 65001
Private Const WM_COPYDATA = &H4A
#If VBA7 Then
Type COPYDATASTRUCT
dwData As LongPtr
cbData As Long
lpData As LongPtr
var sm = (function(){
//declare your variables
var sharedData = {};
//this is your public interface to the statechart model. regular module pattern
return {
sharedData : sharedData,
model : {
states : [
{
@jbeard4
jbeard4 / extended description
Last active December 14, 2015 15:08
possible sails bug regarding policy chaining
This illustrates a possible bug in sails.
Steps to replicate. Submit a form once, then submit it again. The server will break.
This only occurs when using policy chaining, as rolling back the policy chaining (using only one policy per action) seems to resolve the issue.
Steps taken to resolve: I edited /sails/lib/scaffolds/controller.js:133:17 to change `res.json(values)` to `res.send(JSON.stringify(values))`. I did this, as I reasoned that this would avoid writing 'Content-Type : application/json' headers to the response. This changed the behaviour such that it caused the connection to hang on the second POST - a response would never be sent, and the connection would be held open.
I will attempt to create a reduced test case later.
@jbeard4
jbeard4 / collection.js
Last active December 14, 2015 21:09
Proof of concept to parse out dates in waterline before handling them off to the adapter.
//////////////////////////////////////////////////////////////////////
// collection.js
//
// This file is the prototype for collections defined using Waterline
// It contains the entry point for all DML/DQL methods (e.g. User.find())
// as well as some private members used internally, like sync()
//
// For the most part, methods in this file defer to adaper.js for
// their implementation, and the implementation here just validates the parameters.
//
@jbeard4
jbeard4 / stack
Created March 14, 2013 01:08
sails stack trace
jacob@jacob-ThinkPad-W520:~/workspace/sails/sails$ npm test
> [email protected] test /home/jacob/workspace/sails/sails
> node test/start.js
debug: Running tests...
debug: Testing active record (aka waterline)...
-------------------------------------------------------
⋅⋅⋅✈⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅
-------------------------------------------------------
@jbeard4
jbeard4 / build.sh
Last active December 15, 2015 13:19
Using closure compiler to stitch commonjs modules together.
find ./lib -type d \( -path ./lib/rhino -o -path ./lib/node -o -path ./lib/browser/build \) -prune -o -name '*.js' -print | xargs java -jar ~/Downloads/compiler.jar --formatting=PRETTY_PRINT --process_common_js_modules --common_js_entry_module=lib/scion.js --output_wrapper '(function (root, scion) { if (typeof define === "function" && define.amd) { define(o); } else { root.scion = scion(); } }(this, function () { %output% return module$lib$scion;}));' > dist/combined.js
java -jar ~/Downloads/compiler.jar --compilation_level ADVANCED_OPTIMIZATIONS dist/combined.js > dist/out.js
@jbeard4
jbeard4 / xmonad-lion.md
Last active December 19, 2015 04:38 — forked from danchoi/xmonad-lion.md

My Xmonad recipe for OS X Lion

My recipe for setting up Xmonad on Ubuntu GNU/Linux is here.

What is xmonad? Read this page to learn.

Some of these instructions were adapted from the Source Matters Blog. But I also depart from those instructions in certain ways.

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-ca">
<!--
This is a data file that is meant to be read by RSS readers or aggregators.
See http://www.ec.gc.ca/meteo-weather/default.asp?lang=En&n=11703207-1 to learn more about our RSS service.
-->
<title>Toronto - Weather - Environment Canada</title>
<link rel="related" href="http://www.weather.gc.ca/city/pages/on-143_metric_e.html" type="text/html"/>
<link rel="self" href="http://www.weather.gc.ca/rss/city/on-143_e.xml" type="application/atom+xml"/>
Hello, Thanks for signing up for RescueTime. It seems you activated RescueTime through an optimized sign up using the address "[email protected]". You don't need to do anything else at this point, however you can access our site to view your reports and manage your account from any browser by completing your setup with a login. Simply set a password: RescueTime site login setup link: https://www.rescuetime.com/new_user_login/B63HMO1qxIKKGF5_Pqih62B50sT/B632c8DzH0XSNML6yOXwNpa0M0F If you do not need or are not interested in logging into the site, just delete this message. Thanks! The RescueTime Team
{"total_rows":7,"offset":0,"rows":[
{"id":"1c02edda002e09edc6534046ea001e1a","key":"1c02edda002e09edc6534046ea001e1a","value":{"rev":"1-17b4c4a9c23189611f6ae842d48dba8c"},"doc":{"_id":"1c02edda002e09edc6534046ea001e1a","_rev":"1-17b4c4a9c23189611f6ae842d48dba8c","type":"sneezer-questionnaire","takeAllMedications":0,"noseCongested":3,"noseRunny":3,"eyesItching":3,"sneezing":3,"mucous":3,"symptomScore":15,"level":4,"timestamp":"2014-05-19T07:03:34.475Z","coords":{"latitude":44.26559999999999917,"longitude":-88.401700000000005275}}},
{"id":"1c02edda002e09edc6534046ea002c87","key":"1c02edda002e09edc6534046ea002c87","value":{"rev":"1-b096567b57ad56a41ad3c6b64f299b3c"},"doc":{"_id":"1c02edda002e09edc6534046ea002c87","_rev":"1-b096567b57ad56a41ad3c6b64f299b3c","type":"sneezer-questionnaire","takeAllMedications":0,"noseCongested":1,"noseRunny":1,"eyesItching":1,"sneezing":2,"mucous":2,"symptomScore":7,"level":1.8666666666666666963,"timestamp":"2014-05-19T07:08:45.612Z","coords":{"latitude":44.26559999999999917,"longi