Skip to content

Instantly share code, notes, and snippets.

View patkujawa-wf's full-sized avatar

Pat Kujawa patkujawa-wf

  • Workiva
  • Missoula, Montana, USA
View GitHub Profile
//To run Q.js examples:
// 1. Open a new browser tab in Chrome and turn on developer toolbar.
// 2. Copy/Paste this gist in the console and hit enter to run all the snippets.
// Based on the inspiration from samples @ https://github.com/kriskowal/q
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
@patkujawa-wf
patkujawa-wf / numpy-install.log
Created March 11, 2014 22:43
Error from pip install numpy in mac
Downloading/unpacking numpy
Running setup.py (path:/Volumes/workspace/wf-viewer-services/server/smallsky/build/numpy/setup.py) egg_info for package numpy
Running from numpy source directory.
non-existing path in 'numpy/distutils': 'site.cfg'
F2PY Version 2
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['/Volumes/workspace/wf-viewer-services/server/smallsky/lib', '/usr/local/lib', '/usr/lib']
NOT AVAILABLE
@patkujawa-wf
patkujawa-wf / git diff patch between branches.md
Created April 3, 2014 18:36
If you want to get the difference between two branches as a diff patch

If you want to get the difference between two branches, say master and branch-name, use the following command: git diff master..branch-name

If you want that same diff in a patch, because patches are handy, just add the output redirect: git diff master..branch-name > branch-name.patch

If you need to import that patch into something like Crucible then you'll need to get rid of the a and b prefixes that git adds: git diff --no-prefix master..branch-name > branch-name.patch

@patkujawa-wf
patkujawa-wf / MochaTeeReporter.js
Created May 20, 2014 18:48
Idea for a 'tee' reporter to allow multiple reporters in mocha
define(function() {
'use strict';
/**
* Create a 'tee' reporter that just pipes to wrapped reporters.
* Usage: mocha.setup({ reporter: MochaTeeReporter(Reporter1, Rep2, Rep3, ...) });
* @return {Reporter} Suitable for mocha usage
*/
return function(/* reporters */) {
var reporterCtors = [].slice.call(arguments);
var reporters = [];
@patkujawa-wf
patkujawa-wf / flightjs-and-riotjs-notes.md
Created June 30, 2014 21:51
FlightJS and RiotJS notes

Flightjs and riotjs comparison/exploration

Flightjs templating

{{#mailItems}}
  <tr id="{{id}}" class="mail-item">
  {{#important}}
    <td class="span1"><span class="label label-important">Important</span></td>
  {{/important}}
  {{^important}}
@patkujawa-wf
patkujawa-wf / testingInBrowser.js
Last active August 29, 2015 14:06
Using mocha to run specs in-browser, loading with requirejs
// You can paste this code into a browser console and it should work (provided preconditions below are met).
// Preconditions:
// 1. The page you load uses requirejs (so that window.require is defined).
// 2. A local server is running inside a folder with the correct dep's.
// You can do that by dumping this package.json:
var packageJson =
{
"name": "funTestingServer",
"version": "0.0.0",
@patkujawa-wf
patkujawa-wf / testingWithPaw.js
Last active August 29, 2015 14:06
In-browser testing with requirejs, mocha, and the paw touch-emulation library
// You can paste this code into a browser console and it should
// work (provided preconditions below are met).
// Preconditions:
// 1. The page you load uses requirejs (so that window.require is defined).
// 2. A local server is running inside a folder with the correct dep's.
// You can do that by dumping this package.json:
var packageJson =
{
"name": "funTestingServer",
@patkujawa-wf
patkujawa-wf / inBrowserTestingWithJasmine2.js
Last active August 29, 2015 14:06
In-browser jasmine2 testing with requirejs
// You can paste this code into a browser console and it should work
// (provided preconditions below are met).
// Preconditions:
// 1. The page you load uses requirejs (so that window.require is defined).
// 2. A local server is running inside a folder with the correct dep's.
// a. `mkdir bower_components && bower install jasmine`
// 3. Finally, run `python -m SimpleHTTPServer` to serve the directory
@patkujawa-wf
patkujawa-wf / DocumentViewerSpec.js
Created September 22, 2014 16:33
Jasmine 1.3 (with jasmine.async lib) example code
'use strict';
/**
https://github.com/derickbailey/jasmine.async
(MIT License)
Copyright ©2012 Muted Solutions, LLC. All Rights Reserved.
*/
var AsyncSpec = (function() {
'use strict';
@patkujawa-wf
patkujawa-wf / structured_property_example.py
Last active August 29, 2015 14:12
Example of using an ndb StructuredProperty, which basically embeds one entity within another
# Taken from http://ae-book.appspot.com/static/pgae-ndb-20121009.pdf
# Video at https://www.youtube.com/watch?v=xZsxWn58pS0
# • StructuredProperty(InnerModelClass)
# • Uses an ndb.Model subclass to model the property value
# • In code, the value is an instance of the model class
# • In the datastore, fields become properties of the main entity, not separate entities
# • Can be queried!
class PlayerHome(ndb.Model):
sector = ndb.IntegerProperty()