⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
var AmbTest = TestCase("AmbTest"); | |
AmbTest.prototype.testBasic = function () { | |
function beats(ix, iy, jx, jy) { | |
return ix == jx || Math.abs(ix-jx) == jy-iy; | |
} | |
var result = ambRun(function (amb, fail) { | |
var queenPos = []; | |
for (var i = 0; i < 8; i++) { | |
var lastPos = amb([0,1,2,3,4,5,6,7]); |
# All credit: http://stackoverflow.com/questions/4006324/how-to-atomically-delete-keys-matching-a-pattern-with-redis | |
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL |
Mocking - not testing - private functions in JavaScript
Instead of trying to extract a private function, we can rely on mocking/spying. This gist shows how to use the "new Function()" constructor to replace an internal call so that we can mock, spy or stub.
Another response to @philwalton -
http://philipwalton.com/articles/how-to-unit-test-private-functions-in-javascript/
This is a followup to https://gist.github.com/dfkaye/5971486 - a suggestion for
*annotating* functions to be extracted and tested separately (publicly).
-
Data Down / Actions Up
- http://emberjs.jsbin.com/nayaho/edit?html,js - Interdependent select boxes. No observers.
- http://ember-twiddle.com/2d7246875098d0dbb4a4 - One Way Input
-
Plain JSBin's
-
Ember Version Base JSBin's
{ | |
"ecmaFeatures": { | |
"arrowFunctions": true, | |
"binaryLiterals": false, | |
"blockBindings": true, | |
"classes": true, | |
"defaultParams": true, | |
"destructuring": true, | |
"forOf": true, | |
"generators": true, |
These instructions are based on Mistobaan's gist but expanded and updated to work with the latest tensorflow OSX CUDA PR.
""" | |
A bare bones examples of optimizing a black-box function (f) using | |
Natural Evolution Strategies (NES), where the parameter distribution is a | |
gaussian of fixed standard deviation. | |
""" | |
import numpy as np | |
np.random.seed(0) | |
# the function we want to optimize |
I play games regularly, and the sad reality is that it forces me to use Windows on my desktop. There's a Linux installation on there, but rebooting into it is such a massive interruption that I usually just move over to my laptop for programming. Working on a laptop leads to all sorts of ergonomic issues, and it felt like a massive waste to not develop on the desktop hardware I invested so much in. So after extensively researching what the VFIO community has been doing, I've deleted my Windows installation and moved all my gaming into a virtual machine on a Linux host.
Normally VMs are too slow for gaming, but thanks to a feature called VFIO you can run games at near-native performance by passing graphics cards and USB controllers directly to a virtual machine. The only requirement is that your board supports IOMMU, which most modern systems have. In this guide I'll wal