Skip to content

Instantly share code, notes, and snippets.

var sketch = require('sketch')
var document = sketch.getSelectedDocument()
var page = document.selectedPage;
var vFrom = 'v11';
var vTo = 'v12';
var symbols = page.layers.filter(l => l.name.indexOf(vFrom) > -1));
@dannygarcia
dannygarcia / convert.sh
Last active September 23, 2020 23:52
Convert Image Sequence to Animations
# This is not intended to be run as an executable shell script file.
# These are just the commands I use directly in the terminal after `cd`-ing to the image sequence directory.
# Images are named in this format: ####.png
# Convert video to sequence (ffmpeg)
ffmpeg -i anim.mp4 -vf fps=60 %04d.png
# Convert sequence to animated GIF (imagemagick)
convert -delay 2.5 -loop 0 *.png anim.gif
@dannygarcia
dannygarcia / square.frag
Created June 28, 2017 16:27
Draws a square in a fragment shader (unoptimized implementation).
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform vec2 u_mouse;
uniform float u_time;
void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy;
@dannygarcia
dannygarcia / imagemap.html
Created September 16, 2016 06:10
Classic Site Image Map Preview
<style>
.box {
display: inline-block;
border: 2px solid #f2f2f2;
margin: 10px;
padding: 10px;
vertical-align: middle;
border-radius: 10px;
font-family: monospace;
color: #333;
javascript:(function()%7Bvar%20r%20%3D%20%2F%5E.*(%3F%3Avimeo%5C.com%5C%2F(%5Cw%7B8%7D)%7C(%3F%3Ayoutu.be%5C%2F%7Cv%5C%2F%7Cu%5C%2F%5Cw%5C%2F%7Cembed%5C%2F%7Cv%3D)(%5B%5E%23%5C%26%5C%3F%20%5D*)).*%2Fgi%2C%20m%20%3D%20r.exec(window.location.href)%3B%20if%20(m%5B1%5D)%20%7B%20window.open(%22http%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F%22%2Bm%5B1%5D)%3B%20%7D%20else%20if%20(m%5B2%5D)%20%7B%20window.open(%22http%3A%2F%2Fwww.youtube.com%2Fwatch_popup%2F%3Fv%3D%22%2Bm%5B2%5D%2C%20%22_blank%22%2C%20%22height%3D345%2Cwidth%3D560%22)%3B%20%7D%7D)()
AC.Retina = AC.Class();
AC.Retina.prototype = {__defaultOptions: {attribute: "data-hires",recursive: true,queueSize: 8,publishNotifications: true},initialize: function ac_initialize(b) {
this._benchmarkTimer = new Date();
this._options = {};
this._globalBlacklist = null;
this._tagNameBlacklist = null;
this._images = [];
this._paused = false;
this._deferredQueue = null;
this.__queues = [];
[
{ "keys": ["ctrl+s"], "command": "toggle_side_bar" },
{ "keys": ["ctrl+shift+j"], "command": "js_run" }
]
@dannygarcia
dannygarcia / _absolute.scss
Created July 27, 2013 00:20
Absolute Mixin
@mixin absolute($top: false, $right: false, $bottom: false, $left: false) {
position: absolute;
@if $top != false {
top: $top;
}
@if $right != false {
right: $right;
}
@if $bottom != false {
bottom: $bottom;
@dannygarcia
dannygarcia / font.css
Created April 4, 2013 22:31
CSS to override default font styling in the LightGrid tumblr theme.
#content, #content p, #content ul {
font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif;
}
<snippet>
<content><![CDATA[
console.log(${0:msg});
]]></content>
<tabTrigger>cl</tabTrigger>
<scope>source.js</scope>
<description>console.log</description>
</snippet>