Skip to content

Instantly share code, notes, and snippets.

View clarabstract's full-sized avatar

Clara clarabstract

  • Klei Entertainment
  • Vancouver, BC
View GitHub Profile
@clarabstract
clarabstract / ecs.js
Last active January 29, 2020 01:34
doing the ecs
import PIXI from '/node_modules/pixi.js/dist/pixi.js';
window.addEventListener("AutoreloadClient.update", function(ev){
window.location.reload();
});
const app = new PIXI.Application();
document.body.appendChild(app.view);
let _lastId = 0;
let DocumentConnector = connect((state, ownProps) => {
return {
document: lookupDocument(state, ownProps.documentId),
}
}, (dispatch) => {
// Note: this is actually the default behavior if mapPropsToDispatch is null
// I'm just including it here for clarity
return {dispatch}
}, ({document}, {dispatch}, {documentId}) => {
return {
@clarabstract
clarabstract / ConnectedActivityFeed.jsx
Last active December 2, 2016 03:32
Exposing life-cycle methods as props via a Higher Order Component
// example use
export default let ConnectedActivityFeed = compose(
connect(
({activityFeeds = {}}, {userId}) => ({
feedItems: activityFeeds[userId]
}),
{
onPropsChange: ({userId}) =>
requestActvityFeedData(userId)
@clarabstract
clarabstract / aws_security_group.rb
Created July 29, 2014 21:02
Puppet: The End of Reason
Puppet::Type.newtype(:aws_security_group) do
@doc = "Manage AWS Security Groups"
newparam(:name)
ensurable
newproperty(:description)
newproperty(:vpc)
autorequire(:aws_vpc) do
self[:vpc]
end
newproperty(:tags)
@clarabstract
clarabstract / Callback2Promise
Last active December 20, 2015 06:19
Convert callback-based async functions to angular promises.
/*
Call a non-angular, async function that takes callback (and optional
error) arguments via a $q.defer() object and returns an angular
compatible promise.
For example:
somethingAsync(arg1, arg2, successHandler, failureHandler)
As a promise:
@clarabstract
clarabstract / Validate\ and\ go\ to\ error.tmCommand
Created May 15, 2012 21:06
Validate python file, and go to first error
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>changed</key>
<dict>
<key>command</key>
<string>#!/usr/bin/env ruby
flake_bin = ENV['TM_FLAKE8_BIN'] || '/usr/local/bin/flake8'
@clarabstract
clarabstract / example.js
Created February 8, 2012 18:37 — forked from gnarf/example.js
$.fn.newContent
// $.fn.newContent behaves kinda like .live(), it will act on elements that match the
// selector now, or in the future... It automatically runs on any elements immediately
// matched, and also runs once on document ready. You then call .newContent() on any
// freshly created content to trigger searching it
// It will call the given callback function in the context of a
// jQuery set that matches the selector...
$("li.test").newContent(function() {
this.css("color", "red");
x = self._cache.setdefault('network'):
x or IPAddress(self._ip & int(self.netmask), version=self._version)
name = project.contact?.name
# equivalent to:
temp = getattr(project, 'contact', None)
if temp is Null: #or just if not temp... whevs
name = temp
else:
name = temp.name
From 54368c5fc6f4bdecc7018462e03d1730fdf2507c Mon Sep 17 00:00:00 2001
From: Patrick Aljord <[email protected]>
Date: Wed, 28 Oct 2009 13:28:18 -0500
Subject: [PATCH] added task to update comments counts in entries
---
lib/tasks/integrity.rake | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/lib/tasks/integrity.rake b/lib/tasks/integrity.rake