Skip to content

Instantly share code, notes, and snippets.

View tychio's full-sized avatar

Zhang zhengzheng tychio

View GitHub Profile
@justjavac
justjavac / img2txt.js
Last active December 9, 2021 06:46
img2txt:基于canvas的图片转字符画工具
var cv = document.getElementById('cv');
var c = cv.getContext('2d');
var txtDiv = document.getElementById('txt');
var fileBtn = document.getElementById("up-button");
var img = new Image();
img.src = 'a.jpg';
img.onload = init; // 图片加载完开始转换
fileBtn.onchange = getImg;
// 根据灰度生成相应字符
anonymous
anonymous / dabblet.css
Created March 18, 2013 23:59
Untitled
@keyframes flipleft {
from { transform: rotate(0); }
50% { transform: rotate(180deg); }
to { transform: rotate(180deg); }
}
@keyframes flipright {
from { transform: rotate(0); }
50% { transform: rotate(-180deg); }
to { transform: rotate(-180deg); }
@mattpodwysocki
mattpodwysocki / docs.md
Last active December 15, 2015 03:09
Changing select/map to use a scoped this argument in addition to passing the observable sequence.

Changing select/map to use a scoped this argument in addition to passing the observable sequence.

Changes from:

  selector: (T => Int => U)

to:

 selector: (T => Int => Observable => U)
@jineeshjohn
jineeshjohn / gist:5098412
Created March 6, 2013 10:32
String into a javascript function call. Better way to create instance for dynamic class names
var Y = (function(){
return {
Car:function(model){
this.model = model;
this.applyBreak = function(){
alert("done break!!");
}
}
}
@vitaLee
vitaLee / compact_expand_css_command.py
Created June 3, 2012 13:26
SublimeText command for compacting/expanding CSS rules
import sublime
import sublime_plugin
import re
class CompactExpandCssCommand(sublime_plugin.TextCommand):
def run(self, edit, action='compact'):
rule_starts = self.view.find_all('\{')
rule_ends = self.view.find_all('\}')
@paulirish
paulirish / rAF.js
Last active April 17, 2025 15:06
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
/*
natcompare.js -- Perform 'natural order' comparisons of strings in JavaScript.
Copyright (C) 2005 by SCK-CEN (Belgian Nucleair Research Centre)
Written by Kristof Coomans <kristof[dot]coomans[at]sckcen[dot]be>
Based on the Java version by Pierre-Luc Paour, of which this is more or less a straight conversion.
Copyright (C) 2003 by Pierre-Luc Paour <[email protected]>
The Java version was based on the C version by Martin Pool.
Copyright (C) 2000 by Martin Pool <[email protected]>