Skip to content

Instantly share code, notes, and snippets.

View praxxis's full-sized avatar
👨‍🏫
just trying to help

Lindsey praxxis

👨‍🏫
just trying to help
View GitHub Profile
const fs = require("fs");
const words = fs.readFileSync('/usr/share/dict/words', 'utf-8').split("\n") as string[];
const root = {
children: {},
word: false,
};
function addWord(parent: any, word: any) {
### Keybase proof
I hereby claim:
* I am praxxis on github.
* I am praxxis (https://keybase.io/praxxis) on keybase.
* I have a public key ASBiIGTehYr7z79sDwHzv1qSGF6F5qPvm4lf1GsO4b-6Ugo
To claim this, I am signing this object:
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
alert1() {
alert('yes 1');
},
alert2() {
@praxxis
praxxis / controllers.application.js
Created May 19, 2016 19:52
Nested route w/ default
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
@praxxis
praxxis / gist:88d156af12b26a6d9225
Created June 10, 2014 21:54
Sinon useFakeTimers and Ember
test('creates a local creation time property when saving', function () {
expect(1);
var now = new Date().getTime(),
clock = sinon.useFakeTimers(now),
model = App.Model.create(),
promise = Em.RSVP.resolve(),
superStub = sinon.stub(model, '_super').returns(promise);
model.save().then(function () {
@praxxis
praxxis / gist:10213697
Last active August 29, 2015 13:58
Observing parent controller model changes to reset content
App.CommentsNewController = Em.ObjectController.extend({
// create an empty comment when this controller is first created, and when its parent controller changes its model
createNewComment: function () {
this.set('model', DS.Comment.create()); // I don't use Ember Data so this might not be correct
}.on('init').observes('parentController.model'), // `parentController` is a relationship set up by `render`
actions: {
save: function () {
var comment = this.get('model');
comment.save();
@praxxis
praxxis / loading_view_example.js
Last active December 20, 2015 15:49
An implementation of a "promise region" for Backbone.Marionette. Lets you easily create and manage "loading" views, that are eventually replaced by a view with content.
var LoadingView = Backbone.Marionette.ItemView.extend({
template: 'Loading...'
});
var LoadedView = Backbone.Marionette.ItemView.extend({
template: 'Loaded!'
});
var View = Backbone.Marionette.Layout.extend({
template: '<div class="example"></div>',
@praxxis
praxxis / c4.py
Created June 6, 2012 03:27
Connect 4 solver
import json
boards = [
(False, """[
[".", ".", ".", ".", ".", ".", "."],
[".", ".", ".", ".", ".", ".", "."],
[".", ".", ".", ".", ".", ".", "."],
[".", "O", "X", "X", "X", "O", "."],
[".", "O", "X", "X", "O", "O", "X"],