Skip to content

Instantly share code, notes, and snippets.

View mamezito-zz's full-sized avatar

Sergiy Voronov mamezito-zz

View GitHub Profile
@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
@isaacw
isaacw / Layer.createChildrenRefs.coffee
Last active March 5, 2018 20:20
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) ->
for layer in @children
# Get layer name for the key
key = layer.name
send = ->
xhr = new XMLHttpRequest
url = baseUrl
xhr.open 'POST', url, true
xhr.setRequestHeader 'Content-type', 'application/json'
xhr.setRequestHeader 'Authorization', 'Bearer ' + accessToken
xhr.onreadystatechange = ->
if xhr.readyState == 4 and xhr.status == 200
print JSON.parse(xhr.responseText)
if Utils.isDesktop() is true
HTMLPreviewBackground = new Layer
backgroundColor: "#2d383e"
HTMLPreview = Screen
Screen = new Layer
width: 750
height: 1334
clip: true
@wess
wess / request.coffee
Created January 30, 2012 18:17
My quick Request class for CoffeeScript
# This is my first full blow coffeescript class Im working on
# thoughts?
class Request
constructor: ->
@xhrObjects = [
-> new XMLHttpRequest()
-> new ActiveXObject("Msxml2.XMLHTTP")
-> new ActiveXObject("Microsoft.XMLHTTP")
]