Skip to content

Instantly share code, notes, and snippets.

View littlehaker's full-sized avatar

Young littlehaker

  • Bytedance
  • Chengdu, China
  • 20:13 (UTC +08:00)
View GitHub Profile
@insin
insin / app.jsx
Last active July 13, 2021 07:39
React Form Handling - handleFormInputChange (Live version: http://bl.ocks.org/insin/raw/082c0d88f6290a0ea4c7/)
var INPUT_TYPES = 'color|date|datetime|datetime-local|file|month|number|password|range|search|tel|text|time|url|week'.split('|')
var App = React.createClass({
getInitialState: function() {
return {}
},
onChange: handleFormInputChange,
render: function() {
@staltz
staltz / introrx.md
Last active April 29, 2025 08:33
The introduction to Reactive Programming you've been missing
@edokeh
edokeh / index.js
Last active April 25, 2025 14:53
佛祖保佑,永无 BUG
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
/*
* Forked from https://gist.github.com/phoboslab/3773386
* By Malcolm Christie, http://www.malcolmchristie.co.uk/
*
* Usage
*
* Create an instance if ig.TouchButtonCollection as usual
*
* this.buttons = new ig.TouchButtonCollection([
* new ig.TouchButton( 'left', {left: 0, bottom: 0}, 128, 128, this.buttonImage, 0 ),
@bennadel
bennadel / lazy-loading-images.htm
Created July 23, 2013 13:04
Lazy Loading Image With AngularJS
<!doctype html>
<html ng-app="Demo" ng-controller="AppController">
<head>
<meta charset="utf-8" />
<title>
Lazy Loading Images With AngularJS
</title>
<style type="text/css">
@creaktive
creaktive / rainbarf.zsh
Last active April 10, 2025 09:50
rainbarf sans tmux (to enable, "source rainbarf.zsh", under zsh)
# abort if already under tmux
[[ -n $TMUX_PANE ]] && return
# zsh-specific includes
zmodload -i zsh/datetime
zmodload -i zsh/stat
# place to store the chart
RAINBARF_OUT=~/.rainbarf.out
# update period, in seconds
@hui
hui / kindeditor.js.coffee
Last active December 16, 2015 12:29
kindeditor for angularjs
angular.module('kindeditor', []).directive 'kindeditor', ->
require: '?ngModel'
link: (scope, elm, attr, ngModel)->
unless ngModel then return
ngModel.$render = (value)->
unless ngModel.editor
csrfToken = $('meta[name=csrf-token]').attr('content')
csrfParam = $('meta[name=csrf-param]').attr('content')
extraParams = {}
@cultofmetatron
cultofmetatron / gist:5349630
Created April 9, 2013 21:38
passport ajax capable authenticate
app.post('/login', function(req, res) {
console.log(res);
passport.authenticate('local', function(err, user) {
if (req.xhr) {
//thanks @jkevinburton
if (err) { return res.json({ error: err.message }); }
if (!user) { return res.json({error : "Invalid Login"}); }
req.login(user, {}, function(err) {
if (err) { return res.json({error:err}); }
return res.json(
@RyanKung
RyanKung / doubanfm.el
Last active December 14, 2015 10:39
A Simple DoubanFM Client for Emacs
;; Installation:
;; In .emacs add:
;; (require 'doubanfm)
(dolist (path-list (list "./lib/"
"./lib/http-emacs"
"./lib/emms-3.0"))
(add-to-list 'load-path
(expand-file-name path-list (file-name-directory load-file-name))))
<string>(?:^\s+)?(&lt;)((?i:script))\b(?![^&gt;]*/&gt;)</string>
=>
<string>(?:^\s+)?(&lt;)((?i:script))\b(?!([^&gt;]*text/template[^&gt;]*|[^&gt;]*/>))</string>