Skip to content

Instantly share code, notes, and snippets.

Working from home

Nic Luciano kn0ll

Working from home
View GitHub Profile
kn0ll / QueryRenderer.tsx
Last active Jul 23, 2020
attempts to abstract / manage handling apollo network logic. a strongly typed pattern matching type thing for Apollo
View QueryRenderer.tsx
import * as React from 'react';
import { QueryResult } from 'react-apollo';
import { ApolloError } from 'apollo-client';
export enum QueryRendererState {
kn0ll / useHass.ts
Last active Dec 21, 2019
home assistant react hooks
View useHass.ts
import constate from "constate";
import * as React from "react";
import {
} from "home-assistant-js-websocket";
kn0ll /
Created Sep 12, 2015
super hacky script for taking a song off soundcloud and creating a new version where the computer incessantly reads user comments over the audio
import random
import urllib
import urllib2
import soundcloud
import subprocess
from pydub import AudioSegment
def get_track(client_id, sc_url):
client = soundcloud.Client(client_id=client_id)
track = client.get('/resolve', url=sc_url)
View deck.js
], (
) => {
class Mixer extends AudioletGroup {
constructor(audiolet) {
super(audiolet, 1, 1);
kn0ll / backbone.collectionlayout.js
Created Jun 26, 2013
simple backbone collection layout. extends backbone.layout.js. accepts an `ItemView` and a `collection` and appends a new `ItemView` to it's parent container for each model in the collection
View backbone.collectionlayout.js
Backbone.CollectionLayout = Backbone.Layout.extend({
initialize: function() {
Backbone.Layout.prototype.initialize.apply(this, arguments);
this.listenTo(this.collection, 'add', _.bind(this.modelAdded, this));
ItemView: Backbone.Layout,
modelAdded: function(model) {
kn0ll / backbone.layout.js
Last active Dec 19, 2015
simple backbone layout manager (simple subview definitions, with listener cleanup)
View backbone.layout.js
Backbone.Layout = Backbone.View.extend({
initialize: function() {
this.viewReferences = {};
Backbone.View.prototype.initialize.apply(this, arguments);
setView: function(selector, view) {
var $foundViewNode = $(selector, this.$el),
previousView = this.viewReferences[selector];
kn0ll /
Created Feb 28, 2013
a session model for brainy
define [
], (Backbone, User) ->
class extends Backbone.Model
idAttribute: '_id'
urlRoot: '/sessions'
kn0ll / class-method.js
Created Feb 22, 2013
Brainy collection using a class method.
View class-method.js
], function(Backbone) {
return Backbone.Collection.extend({
url: '/boops'
}, {
byUserId: function(user_id) {
kn0ll /
Created Feb 10, 2013
event listener and event emitter classes inspired by backbone.
# event emitter is an object which is
# responsible for triggering events, and binding
# functions to those events.
class EventEmitter
# events map event names
# to functions which are bound
# to that event. calling model.on evt, fn
# will add that function to the events hash.
events: null
kn0ll /
Created Feb 1, 2013
a demo osc gui using various backbone/osc components i've written.
require [
], ($, OscClient, RangeView) ->
osc_client = new OscClient
bar_view = new RangeView
model: osc_client
You can’t perform that action at this time.