Skip to content

Instantly share code, notes, and snippets.

View RenderCoder's full-sized avatar
🌴
On vacation

RenderCoder RenderCoder

🌴
On vacation
View GitHub Profile
@RenderCoder
RenderCoder / thinking_about_table_view_update.swift
Created August 1, 2017 11:59
关于更新 tableview 内容显示的一个思路
//: [Previous](@previous)
import Foundation
let originalList: [String] = ["a", "b", "c", "d", "e", "f", "g"]
let oldList: [String] = ["b", "c", "e", "g"]
let newList: [String] = ["a", "b", "d", "f", "g"]
func indexInOriginalList(forItem item: String) -> Int? {
return originalList.index(of: item)
@RenderCoder
RenderCoder / highcharts_demo.js
Created April 12, 2017 09:43
Highcharts 绘制曲线
Highcharts.chart('container', {
chart: {
type: 'spline'
},
title: {
text: 'Solar Employment Growth by Sector, 2010-2016'
},
subtitle: {
text: 'Source: thesolarfoundation.com'
@RenderCoder
RenderCoder / cloudmenu_down.json
Created March 18, 2017 06:32
云食谱下发数据示例 #tags: 阿里智能
{
"WF":{
"extra":{
"StepNum":"5",
"WF_ID":"750410",
"Type":"1",
@RenderCoder
RenderCoder / device_up.json
Last active March 18, 2017 06:31
阿里智能设备上报示例 #tags: 阿里智能
{
"WorkMode": {
"value": "1"
},
"WF": {
"extra": {
"Steps": "1",
"WF_ID": "750410",
"StepNum": "5"
},
@RenderCoder
RenderCoder / mtop_example.js
Created March 16, 2017 09:44
AliSmart mtop api use
var opt = {
api: "mtop.method",
param: {
friendid : "xxx"
}
};
DA.alinkRequestMtopProxy(opt, function (resp) {
callback(resp.result);
});
@RenderCoder
RenderCoder / jQuery-plugin-authoring.md
Created February 10, 2017 13:45 — forked from quexer/jQuery-plugin-authoring.md
如何编写 jQuery 插件

创建插件


看来 jQuery 你已经用得很爽了,想学习如何自己编写插件。非常好,这篇文档正适合你。用插件和方法来扩展 jQuery 非常强大,把最聪明的功能封装到插件中可以为你及团队节省大量开发时间。

开始

var $input = $('.search').val('query');
var e = document.createEvent('HTMLEvents');
e.initEvent('input', true, true);
$input[0].dispatchEvent(e);
@RenderCoder
RenderCoder / fakeALiSmartLoadPageFunction.js
Created January 18, 2017 05:51
Fake ALiSmart load page function
DA.loadPage = function(){
var args = Array.from(arguments);
var gets = $.param(args[args.length-1]);
var basicPathName = location.pathname.match(/^\/\w+\//);
var subPathCache = '';
for(var i=0,len=args.length-1; i<len; i++){
subPathCache += args[i];
}
var path = basicPathName + subPathCache + '?' + gets;
console.log(path);
@RenderCoder
RenderCoder / GIF-Screencast-OSX.md
Created November 16, 2016 07:33 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@RenderCoder
RenderCoder / escape.js
Created May 31, 2016 11:17
去除控制字符,替换为unicode
var escap = function(string) {
// If the string contains no control characters, replace the
// offending characterswith safe escape sequences.
var escapable = /[\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
var meta = { // table of character substitutions
'\b' : '\\b',
'\t' : '\\t',
'\n' : '\\n',
'\f' : '\\f',
'\r' : '\\r',