Skip to content

Instantly share code, notes, and snippets.

View cly's full-sized avatar

Charlie Liang Yuan cly

  • Lyft
  • San Francisco
View GitHub Profile
@cly
cly / index.html
Created November 25, 2017 18:42 — forked from ItsMeSousuke/d3_realtime_linechart.html
Realtime Line Chart with D3 v4
<style>
.axis {
font-family: sans-serif;
fill: #d35400;
font-size: 12px;
}
.line {
fill: none;
stroke: #f1c40f;
@cly
cly / sample.gpx
Created July 12, 2016 07:57
Sample .GPX file
<?xml version="1.0" encoding="UTF-8"?>
<gpx
version="1.1"
creator="Runkeeper - http://www.runkeeper.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/1"
xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
xmlns:gpxtpx="http://www.garmin.com/xmlschemas/TrackPointExtension/v1">
<wpt lat="37.778259000" lon="-122.391386000"><ele>3.4</ele><time>2016-06-17T23:41:03Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>171</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></wpt>
<wpt lat="37.778194000" lon="-122.391226000"><ele>3.4</ele><time>2016-06-17T23:41:13Z</time><extensions><gpxtpx:TrackPointExtension><gpxtpx:hr>171</gpxtpx:hr></gpxtpx:TrackPointExtension></extensions></wpt>
@cly
cly / Animation.md
Created November 9, 2015 18:57 — forked from JeOam/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

  • view hierarchy
  • layer tree
function OHLC(params) {
OHLC.prototype._init = function (params) {
this.height = params.height || 650;
this.width = params.width || 1300;
this.margin = params.margin || 50;
this.data = params.data;
this.movingAverageTypes = ['mov_avg_10d', 'mov_avg_50d', 'mov_avg_200d'];
this.dateFormat = d3.time.format("%Y-%m-%d");
// validation mixin
var validation = {
getDefaultProps: function () {
return {
validate: []
}
}
, hasErrors: function () {
var errors = []
@cly
cly / gist:9342578
Created March 4, 2014 08:44
mtgox src
<?php
namespace Money;
class Bitcoin {
#const BITCOIN_NODE = '173.224.125.222'; // w001.mo.us temporary
const BITCOIN_NODE = '50.97.137.37';
static private $pending = array();
public static function update() {
@cly
cly / sendak13.js
Created June 10, 2013 21:11
Google doodle sendak June 13
/*
<center><div id="lga" style="height:231px;margin-top:-22px"><style>#hplogo{background:url(/logos/2013/sendak/sendak-hp.jpg) no-repeat 9px 70px;height:231px;margin-top:-32px;outline:none;overflow:hidden;position:relative;width:600px;-moz-user-select:-moz-none;-ms-user-select:none;-webkit-user-select:none}</style><div id="hplogo" dir="ltr" tabindex="0" style="background-color: rgb(255, 255, 255); background-position: initial initial; background-repeat: initial initial;"><canvas width="600" height="231" style="position: absolute; top: 0; left: 0px; z-index: 1; cursor: default;"></canvas><canvas width="600" height="231" style="position: absolute; top: 0px; left: 0px; cursor: default;"></canvas></div><script>(function(){window.google||(window.google={});google.doodle||(google.doodle={});google.doodle.url="/search?q=Maurice+Sendak&oi=ddle&ct=maurice_sendaks_85th_birthday-1525005-hp";google.doodle.alt="Maurice Sendak\'s 85th Birthday";if(!google.doodle||!google.doodle.loaded){var a=["google","doodle","loaded"],b=
@cly
cly / LICENSE.txt
Created June 6, 2011 07:35 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE