This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Creates a python socket client that will interact with javascript.""" | |
import socket | |
socket_path = '/tmp/node-python-sock' | |
# connect to the unix local socket with a stream type | |
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
client.connect(socket_path) | |
# send an initial message (as bytes) | |
client.send(b'python connected') | |
# start a loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { forEach, set } from 'lodash'; | |
export class Enum <T>{ | |
constructor(...values) { | |
forEach(values, (value) => set(this, value, Symbol(value)); | |
} | |
get (value: T): Symbol { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.12) | |
// Compass (v1.0.3) | |
// ---- | |
@function to-string($value) { | |
@return inspect(#{$value}); | |
} | |
// general string replace functionality! what's next, regex? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(window) { | |
var Utils = window.Utils || function() { /* no need to set initial params as of yet */ }; | |
Utils.prototype = { | |
ajaxGet: function(url, cb, passVar) { | |
var request = new XMLHttpRequest(); | |
request.open('GET', url, true); | |
request.onreadystatechange = function() { | |
if (this.readyState === 4) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//borrowed this indexOf polyfill from MDN | |
if (!Array.prototype.indexOf){ | |
Array.prototype.indexOf = function(elt /*, from*/){ | |
var len = this.length >>> 0; | |
var from = Number(arguments[1]) || 0; | |
from = (from < 0) ? Math.ceil(from) : Math.floor(from); | |
if (from < 0) | |
from += len; | |
for (; from < len; from++){ | |
if (from in this && this[from] === elt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
TODO build non-jquery dependent class manipulations in utils and allow passing | |
in a custom animation function / library | |
*/ | |
class Transitioner { | |
constructor(){ | |
this.fake = document.createElement("fake") | |
//call set end() with transition object | |
this.end = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Organizing Sass Transitions with Transitioner | |
// | |
// transitioner creates | |
// | |
// .root .selector { ...transition rules... } | |
// .selector.classNameToBeAnimated { ...properties to be transitioned... } | |
// | |
// great for organizing multiple transitions when adding a single class via js | |
// feed it classes in quotes, anything else can go either way | |
// write "extend #id-name" as 2nd arg to extend previous transition rules |