Skip to content

Instantly share code, notes, and snippets.

@hSATAC
hSATAC / gist:6198933
Created August 10, 2013 03:29
Make Your Views Fast by Evadne Wu

Make Your Views Fast by Evadne Wu

  • rendering pipeline

  • layer tree(your code) vs presentation tree => pass to render tree

  • blending vs compositing

view 疊太深 => draw into your own buffer <=> against animation

# 單純用來決定該有哪些 interface 和一些是在我們這邊處理的邏輯
class PaymentGateway
attr_reader :email
SUBSCRIPTION_AMOUNT = 10.to_money
def initialize(user)
@email = user.email
end
@hSATAC
hSATAC / gist:7853379
Last active December 30, 2015 16:18
Run vim from go just like `git commit` proof of concept
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
)
var (
@parroty
parroty / gist:98a68f2e8a735434bd60
Created February 24, 2015 23:23
Macro wrapper for fetching default value of map
defmodule Fetcher do
def db_value_for(key) do
IO.puts "processing..."
"db value for #{key}"
end
defmacro get(map, key, default \\ nil) do
quote do
case Map.get(unquote(map), unquote(key)) do
nil -> unquote(default)
@statianzo
statianzo / current.js
Last active August 30, 2016 13:47
unknown props warning
const ContactBadge = (props) => (
<div className='Badge' {...props}>
<div>{props.user.name}</div>
<div>{props.contactMethod.type}</div>
</div>
);
export default connect((state, {userId, contactMethodId}) => ({
user: selectUser(state, userId),
contactMethod: selectContactMethod(state, contactMethodId)
@meh
meh / lol.exs
Created December 16, 2013 17:29
defmodule Fun do
def arity(fun) do
case :erlang.fun_info(fun, :arity) do
{ :arity, arity } ->
arity
end
end
def adapt!(fun, 0) do
fn -> fun.([]) end
@asaaki
asaaki / currying.ex
Last active March 30, 2017 23:49
Partial Functions / Currying
# Another example for: http://onor.io/2014/03/31/partial-function-application-in-elixir/
defmodule PartFuncs do
defp addfun(x, y), do: x + y
# return a partially applied function
def add(a), do: &addfun(a, &1)
# could also easily be written as: addfun(a, b)
def add(a, b), do: (&addfun/2).(a, b)
@prestonparris
prestonparris / reactjs-conf-2015-notes.md
Last active April 6, 2017 21:32
Notes from the 2015 React.js Conference

Reactjs conf 2015 Notes

  • react native announced

    • Allows you to use react style javascript to target native ios and android, native views, live reloading
    • intro pt1
    • intro pt2
    • facebook groups app uses react native with graphql and relay
  • realtime page tweaking

    • rethink best practices and workflows
  • inmutability is a good idea

@coodoo
coodoo / quick-guide-to-react-flux
Last active May 1, 2017 12:04
這是 jsdc 2014 演講後提供的快速學習指南。有問題請到 [React.tw 中文群組](https://www.facebook.com/groups/reactjs.tw/) 討論
# 內容
# repo 位置
- https://github.com/facebook/react
- https://github.com/facebook/flux
# 官網
- React
* http://facebook.github.io/react/
@BernardNotarianni
BernardNotarianni / spacemacssheet.tex
Last active August 22, 2017 13:25
Spacemacs Cheat Sheet
\documentclass[10pt,landscape]{article}
\usepackage{multicol}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[landscape]{geometry}
\usepackage{hyperref}
% based on latex cheat sheet https://wch.github.io/latexsheet/
%
% To make this come out properly in landscape mode, do one of the following