Skip to content

Instantly share code, notes, and snippets.

@subtleGradient
subtleGradient / FramerLayer.NoFlo.js
Last active October 27, 2018 14:27
Quick and dirty Framer Layer component for NoFlo
/**
1. Go to http://app.flowhub.io/
2. Open or create a project
3. Create a new component
4. Paste all this code into the *Implementation* section
5. Switch back to the graph editor
6. Search for this component
* Note: You can't skip this part! There's a bug in the noflo-ui that makes it impossible to insert a component without searching first. This is beta software.
7. Insert an instance of this component
8. Press the play button in the *Preview* section on the right side of the graph editor UI
tell application "Google Chrome"
activate
set theUrl to "http://tycho.usno.navy.mil/cgi-bin/timer.pl"
if (count every window) = 0 then
make new window
end if
set found to false
set theTabIndex to -1
@subtleGradient
subtleGradient / node-inspect-Photoshop-node.sh
Created October 3, 2013 13:59
Use node-inspect Blink inspector GUI with Photoshop-node. Tested on Mac OS X. I'm not sure how to do it on Windows yet.
#!/usr/bin/env bash
kill -s USR1 `pgrep -l Photoshop-node|cut -d" " -f1`
(sleep 1; open -a 'Google Chrome' http://127.0.0.1:8080/debug?port=5858)&
node-inspector
@subtleGradient
subtleGradient / Behavior.framer.js
Last active July 28, 2017 17:27
Simple Behavior sheet system for FramerJS. Allows you to apply pre-defined behaviors to your layers by changing the layer name. by Thomas Aylott (http://subtlegradient.com) Copyright 2013 Facebook. All rights reserved. MIT License.
function Behavior(PSD){
var _BehaviorNames = Object.keys(Behavior.behaviors)
.filter(function(BehaviorName){ return !!Behavior.behaviors[BehaviorName].namingPattern });
Object.keys(PSD).forEach(function(layerName){
var layer = PSD[layerName];
_BehaviorNames.forEach(function(BehaviorName){
var match = layerName.match(Behavior.behaviors[BehaviorName].namingPattern);
try {
@subtleGradient
subtleGradient / watch.node.js
Created July 23, 2013 02:33
Usage: watch.node.js SomeFile.whatever "clear; time test.sh"
#!/usr/bin/env node
/*jshint asi:true*/
fs = require('fs')
child_process = require('child_process')
if (module.id == '.') watchForChangesAndThenExec(process.argv[2] || process.env.PWD, process.argv[3] || "echo")
module.exports = exports = watchForChangesAndThenExec
@subtleGradient
subtleGradient / delete twitter DMs.js
Created July 8, 2013 02:07
Delete Twitter Direct Messages. Go here: https://twitter.com/messages?since_id=0 Then paste this stuff into your Chrome inspector console
// delete console.log
querySelectorAttempt._timerIDs = []
function querySelectorAttempt(selectors, callback, _attempts){
if (!Array.isArray(selectors)) selectors = selectors.toString().split(/\s*,\s*/)
console.log('querySelectorAttempt', selectors, _attempts)
if (_attempts == null) _attempts = 20;
var elements
selectors.forEach(function(selector){
if (elements && elements.length > 0) return;
elements = document.querySelectorAll(selector);
@subtleGradient
subtleGradient / index.js
Created June 5, 2013 19:25
MeeMoo.org DataFlow Graph from Quartz Composer QTZ file
var bplistParser = require('bplist-parser')
var bplistCreator = require('node-bplist-creator')
var fs = require('fs')
var DFGraph = {}
DFGraph.edgeFromQCConnection = function(qcConnection, connectionKey){
return {
source:{node: qcConnection.sourceNode, port:qcConnection.sourcePort},
target:{node: qcConnection.destinationNode, port:qcConnection.destinationPort}
<element name="comment-form" constructor="CommentForm">
<template>
<form class="commentForm" onSubmit={this.handleSubmit}>
<input type="text" placeholder="Your name" ref="author" />
<input
type="text"
placeholder="Say something..."
ref="text"
/>
@subtleGradient
subtleGradient / README.md
Created July 19, 2012 13:01
How to create a double-click-to-start web server

How to create a double-click-to-start web server

  1. Download the "Start HTTP Server Here.command" file
    • In Safari you can do that by ⌥ (option) clicking the "raw" link next to that script.
  2. Add the executable flag
    so that it will run when you double-click it
    • type chmod +x "$HOME/Downloads/Start HTTP Server Here.command"
  3. Move the command file into the root folder of your website
  4. Double-click it to start your webserver.
    Your browser will load it up automatically
var regexp = LSD.RegExp({
'fn_tail': '\\.',
'fn_arguments': '\\g<inside_round>',
'fn_name': '\\g<unicode>',
'fn': '\\g<fn_tail>?\\g<fn_name>\\(\\g<fn_arguments>\\)',
'block_arguments': '\\g<inside_curly>',
'block_body': '\\g<inside_curly>',
'block': '\\{\\g<block_arguments>?\\g<block_body>\\}',