Skip to content

Instantly share code, notes, and snippets.

@small-carbon
small-carbon / uniq.js
Created January 19, 2019 15:44 — forked from telekosmos/uniq.js
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});

Backstory: I decided to crowdsource static site generator recommendations, so the following are actual real world suggested-to-me results. I then took those and sorted them by language/server and, just for a decent relative metric, their Github Watcher count. If you want a heap of other projects (including other languages like Haskell and Python) Nanoc has the mother of all site generator lists. If you recommend another one, by all means add a comment.

Ruby

@small-carbon
small-carbon / api-provider.js
Created January 8, 2016 08:21 — forked from jelbourn/api-provider.js
Example of using an angular provider to build an api service. Subject of August 20th 2013 talk at the NYC AngularJS Meetup. http://www.meetup.com/AngularJS-NYC/events/134578452/See in jsbin: http://jsbin.com/iWUlANe/5/editSlides: https://docs.google.com/presentation/d/1RMbddKB7warqbPOlluC7kP0y16kbWqGzcAAP6TYchdw
/**
* Example of using an angular provider to build an api service.
* @author Jeremy Elbourn (@jelbourn)
*/
/** Namespace for the application. */
var app = {};
/******************************************************************************/
@small-carbon
small-carbon / TiDocs.sh
Created October 21, 2015 06:41 — forked from eric-hu/TiDocs.sh
Getting offline version of Titanium mobile docs on Ubuntu
#! /bin/sh
# Run this from the folder you want to be the parent of your docs
# By default, generated docs go into
# titanium_mobile/dist/apidoc/ti_mobile_docs/
#
# This can be changed below
git clone https://github.com/appcelerator/titanium_mobile.git
cd titanium_mobile
sudo apt-get install python-setuptools python-dev
/**
* 改变窗口大小的时候自动根据iframe大小设置jqGrid列表宽度和高度
* 参数说明:{
* enableAutoResize : 是否开启自动高度和宽度调整开关
* dataGrid : jqGrid数据列表的ID
* callback : 计算完dataGrid需要的高度和宽度后的回调函数
* width : 默认为iframe的宽度,如果指定则设置为指定的宽度
* height : 默认为iframe的高度,如果指定则设置为指定的高度
* beforeAutoResize : 窗口大小调整时自动设置之前
* afterAutoResize : 窗口大小调整时自动设置之后