Skip to content

Instantly share code, notes, and snippets.

View Rayi's full-sized avatar

Rayi Rayi

  • Chengdu, China
View GitHub Profile
@Rayi
Rayi / gist:782c76d3f33bdd17f5a98028293ef076
Created July 23, 2018 06:19 — forked from kejun/gist:72112e5848f5e3921b0d
react + linear partition算法实现的图墙布局
var React = require('react');
var EventListener = require('react/lib/EventListener');
var partition = require('linear-partitioning');
var TileLayout = React.createClass({
getDefaultProps: function() {
return {
gutter: 0,
photos: []
}
@Rayi
Rayi / sublime-text-3-build-3065-license.md
Created December 23, 2015 04:59
Sublime Text 3 (build 3065+) - VALID License

SublimeText3 Valid License without cracking! Just download/install then use this license.

Notice that it may not work on dev builds, but still works on 3083 build!

----- BEGIN LICENSE -----

Andrew Weber
Single User License
EA7E-855605
813A03DD 5E4AD9E6 6C0EEB94 BC99798F
@Rayi
Rayi / 0_reuse_code.js
Created April 1, 2014 10:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Rayi
Rayi / props.md
Created August 16, 2013 06:53 — forked from yyx990803/props.md

TL,DR: 务必总是在构建函数里定义实例属性。

在小胖的PoorPhy物理库里,有很多类似这样的代码:

function WorldA () {
  // ...
}

WorldA.prototype = {
function randomColor(){
return "rgb("+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+","+Math.floor(Math.random()*255)+")";
}
function showBoxes(window) {
var rects = [];
function getRects(node){
var range = window.document.createRange();
range.setStartBefore(node);
range.setEndAfter(node);
@Rayi
Rayi / fs.extra.js
Created November 14, 2012 13:48 — forked from coolaj86/fs.extra.js
fs.copy and fs.move for Node.JS
/*
UPDATE: this has finally been pushed to npm as `fs.extra`
URL: https://github.com/coolaj86/node-examples-js/tree/master/fs.extra
*/
(function () {
"use strict";
var fs = require('fs')
, util = require('util')
;
@Rayi
Rayi / Messup.cs
Created November 5, 2012 13:44
Mess up words but readable.
class Program
{
static void Main(string[] args)
{
string paragraph = "The phrase \"Gangnam Style\" is a Korean neologism that refers to a lifestyle associated with the Gangnam district of Seoul. The song and its accompanying music video went viral in August 2012 and have influenced popular culture since then. \"Gangnam Style\" is considered by some to be a worldwide phenomenon, while others have praised \"Gangnam Style\" for its catchy beat and PSY's amusing dance moves in the music video and during live performances. On September 17, the song was nominated for Best Video at the upcoming 2012 MTV Europe Music Awards to be held in Frankfurt, Germany. On September 20, 2012, \"Gangnam Style\" was recognized by Guinness World Records as the most \"liked\" video in YouTube history.";
Console.WriteLine("-----Paragraph before process:-----");
Console.WriteLine(paragraph);
string result = MakeRandom(paragraph);
@Rayi
Rayi / OpenANativeAppInWebApp.html
Created October 30, 2012 15:48 — forked from lbj96347/OpenANativeAppInWebApp.html
Open a native app in Web App
<!DOCTYPE html>
<html>
<head>
<!-- This is a template for Web App Setup -->
<!-- Author : @CashLee李秉骏 -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Web App icon -->
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
@Rayi
Rayi / bootstrapslide
Created August 22, 2012 00:46
Bootstrap Slide Data
{"slides":[{"items":{"title":{"value":"Bootstrap 2.1.0 Update Detail"},"content":{"value":"By Rayi"},"slide":{"type":"slide"}},"layout":"title"},{"items":{"title":{"value":"新的界面"},"slide":{"type":"slide"}},"layout":"subtitle"},{"items":{"slide":{"type":"slide"},"content":{"value":"http://html5slides-slides.stor.sinaapp.com/upload/13455548053992da784281658bd4935d387d03831f.png","type":"img","position":{"left":113.01527678511525,"top":136.3931321005785}}}},{"items":{"title":{"value":"功能更新"},"slide":{"type":"slide"}},"layout":"subtitle"},{"items":{"title":{"value":"Images"},"slide":{"type":"slide"},"content":{"value":"http://html5slides-slides.stor.sinaapp.com/upload/1345555030e3eb316811fde14a9fb8525e82735bad.png","type":"img"}}},{"items":{"title":{"value":"Submenu support on dropdowns"},"slide":{"type":"slide"},"content":{"value":"http://html5slides-slides.stor.sinaapp.com/upload/1345565349b999a607102ec0d293e78db10ea698a1.png","type":"img","position":{"width":771.5310274699088,"height":442.7272668865879}}}},{"i
@Rayi
Rayi / rmDelayOnclick.js
Created June 19, 2012 18:00 — forked from lbj96347/rmDelayOnclick.js
RemoveDedayOnclick
/*when you use an onclick event in an html element,iPhone webkit browser would have a delay.So you should deal with it.This part of js would help you.You just need to add this file in your html page and use ontouchstart/ontouchend/ontouchmove to replace onclick event */
/* 当你在使用onclick事件的时候,iPhone手机上面的safari浏览器会对事件产生一个延误(大概是0.3秒左右),这个时候你必须对这个事件作出一些处理。 然后用ontouchstart ontouchend ontouchmove去代替原本的onclick事件即可*/
function NoClickDelay(el) {
this.element = el;
if( window.Touch ) this.element.addEventListener('touchstart', this, false);
}
NoClickDelay.prototype = {