Skip to content

Instantly share code, notes, and snippets.

View davo's full-sized avatar
🦮
Golden

Davo Galavotti davo

🦮
Golden
View GitHub Profile
@davo
davo / getIntanceMethods.coffee
Created June 4, 2018 14:30
Debugging with Coffeescript
hasMethod = (obj, name) ->
desc = Object.getOwnPropertyDescriptor(obj, name)
! !desc and typeof desc.value == 'function'
getInstanceMethodNames = (obj, stop) ->
array = []
proto = Object.getPrototypeOf(obj)
while proto and proto != stop
Object.getOwnPropertyNames(proto).forEach (name) ->
if name != 'constructor'
@davo
davo / coffeelint.json
Last active May 1, 2018 04:19
Cofeescript Lint
{
"arrow_spacing": {
"level": "warn"
},
"braces_spacing": {
"level": "warn",
"spaces": 0,
"empty_object_spaces": 0
},
"camel_case_classes": {
@davo
davo / gsap-properties-cheat-sheet.md
Created April 12, 2018 21:35 — forked from lunelson/gsap-properties-cheat-sheet.md
Greensock Properties Cheat Sheet

Greensock CSS properties Cheat Sheet

I wrote this as a reference for myself because some of the property names are non-obvious, and there are a number of relevant special properties, and there is no central concise listing of them all in GSAP Docs, other than (in longer form) on the CSSPlugin page.

Standard CSS properties

...are all supported, with hyphenated-names becoming camelCaseNames. Non-animatable properties are also supported but they will be set at the beginning of the tween.

Special mentions:

@davo
davo / airtableQuery.js
Created April 9, 2018 19:28
Airtable.js Query
const requestContent = (tableId, tableName) => {
let _content = []
return new Promise((resolve, reject) =>
base(tableId)
.select({
view: tableName
})
.eachPage(
rows =>
rows.forEach((row, index) => {
@davo
davo / README.md
Last active April 1, 2018 18:13 — forked from curran/.block
Color and Texture with textures.js

A test of textures.js that shows one approach for having independent scales for color and texture.

This ended up being more code than expected, because each (color, texture) combination needs to be defined independently. This is because each texture ends up as an SVG def, whose color properties (fill, stroke) cannot be changed per mark. Each (color, texture) pair must exist globally, then be applied to each mark.

@davo
davo / Layer.createChildrenRefs.coffee
Last active March 5, 2018 20:19 — forked from isaacw/Layer.createChildrenRefs.coffee
Creates convenience refs on targeted layers from the design tab so that we don't have to use Layer::childrenWithName.
# Layer::createChildrenRefs
# Creates convenience refs on targetd layers from the design tab so that we don't have to use Layer::childrenWithName.
# Pass recursive=true to do this for all descendant layers while maintaining hierarchy.
Layer::createChildrenRefs = (recursive=false, camelCase=true, ignoreLayers=true) ->
for layer in @children
# Filter any layer with a name starting with '_' as 'private layers'.
unless ignoreLayers is false
if _.startsWith(layer.name, '_')
return true
@davo
davo / moreutills-define.coffee
Created February 28, 2018 23:26
moreutills-define.coffee
Utils.define = (layer, property, value, callback, validation, error) ->
validation ?= -> true
error ?= "Layer #{layer.id}'s property '#{property}' was given the wrong value type."
Object.defineProperty layer,
property,
get: -> return layer["_#{property}"]
set: (value) ->
if value?
if not validation(value) then throw error
@davo
davo / svg-crowbar.js
Created December 21, 2017 18:20
SVG Crowbar
(function() {
var doctype =
'<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">';
window.URL = window.URL || window.webkitURL;
var body = document.body;
var prefix = {
xmlns: 'http://www.w3.org/2000/xmlns/',
@davo
davo / .block
Last active December 12, 2017 21:44 — forked from jstcki/README.md
d3.grid - d3.js v4(wip)
license: mit
@davo
davo / .block
Created September 27, 2017 19:42
A Material Design Gauge in Pure CSS/HTML
license: mit