Skip to content

Instantly share code, notes, and snippets.

@chenglou
chenglou / gist:40b75d820123a9ed53d8
Last active March 13, 2024 12:14
Thoughts on Animation

Interesting part (unmounting & API) is at the end if you're not interested in the rest =).

Stress Tests

This animation proposal is just an attempt. In case it doesn't work out, I've gathered a few examples that can test the power of a future animation system.

  1. Parent is an infinitely spinning ball, and has a child ball that is also spinning. Clicking on the parent causes child to reverse spinning direction. This tests the ability of the animation system to compose animation, not in the sense of applying multiple interpolations to one or more variables passed onto the child (this should be trivial), but in the sense that the parent's constantly updating at the same time as the child, and has to ensure that it passes the animation commands correctly to it. This also tests that we can still intercept these animations (the clicking) and immediately change their configuration instead of queueing them.

  2. Typing letters and let them fly in concurrently. This tests concurrency, coordination of an array of ch

@ktmud
ktmud / gulpfile.js
Last active February 28, 2022 10:39
An example gulpfile.js with bower components and live reload support
var BatchStream = require('batch-stream2')
var gulp = require('gulp')
var coffee = require('gulp-coffee')
var uglify = require('gulp-uglify')
var cssmin = require('gulp-minify-css')
var bower = require('gulp-bower-files')
var stylus = require('gulp-stylus')
var livereload = require('gulp-livereload')
var include = require('gulp-include')
var concat = require('gulp-concat')
@mikeperri
mikeperri / gist:8344779
Last active January 2, 2016 18:39
Reddit Enhancement Suite module to show a Loch Ness Monster icon on long posts that end with the tree fiddy thing. Based on https://gist.github.com/Raugturi/1077321
/*
To install, find your reddit_enhancement_suite.user.js file and paste it in after the other modules.
Firefox seems to detect when you tamper with extensions, so for now this is only working in Chrome.
1. WIN: Press Windows+R and paste in "%HOMEDRIVE%%HOMEPATH%\AppData\Local\Google\Chrome\User Data\Default\Extensions" (w/o quotes).
MAC: Open a Finder window, press Command+Shift+G, and paste in "~/Library/Application Support/Google/Chrome/Default/Extensions" (w/o quotes).
2. Paste "reddit_enhancement_suite.user.js" (w/o quotes) into the search bar, and search in the Extensions folder.
3. Open the file in a text editor (if you don't have one, download Sublime Text from sublimetext.com and use that).
Paste the code right after all the other module definitions, which should be around line 21323.
@branneman
branneman / better-nodejs-require-paths.md
Last active May 15, 2025 11:17
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@FokkeZB
FokkeZB / SLIDE-DOWN.md
Last active November 12, 2020 13:47
Slide-down menu for Titanium Alloy

This gist shows you how to do a slide-down menu in Titanium.

Features:

  • Toggle using a menu button in the ever-visible navigation bar on the top of the screen
  • Menu options animating down from under the navigation bar
  • Hide by swiping the menu options up
  • Hide by tapping the area below the menu options (being the view covered by the slide-down menu

Images:

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active April 28, 2025 00:02
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@jinze
jinze / forever-initd-example.sh
Created September 19, 2012 09:50
forever init.d example
#!/bin/bash
#
# initd-example Node init.d
#
# chkconfig: 345 80 20
# description: Node init.d example
# processname: node
# pidfile: /var/run/initd-example.pid
# logfile: /var/log/initd-example.log
#
@minardimedia
minardimedia / gist:3610889
Created September 3, 2012 17:06
String Functions for Javascript – trim, to camel case, to dashed, and to underscore
Trim String
String.prototype.trim = function(){
return this.replace(/^\s+|\s+$/g, "");
};
To Camel Case
String.prototype.toCamel = function(){
return this.replace(/(\-[a-z])/g, function($1){return $1.toUpperCase().replace('-','');});
@turtlesoupy
turtlesoupy / nginx.conf
Created July 8, 2012 21:16
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
@blakehilscher
blakehilscher / slim-html5-boilerplate
Created July 7, 2011 16:23
Slim HTML5 Boilerplate
doctype html
/[if lt IE 7]
html.no-js.ie6.oldie lang="en"
/[if IE 7]
html.no-js.ie7.oldie lang="en"
/[if IE 8]
html.no-js.ie8.oldie lang="en"
/[if gte IE 8]
html.no-js lang="en"
head