Skip to content

Instantly share code, notes, and snippets.

<!-- Favicons and touch icons -->
<!-- For retina-display iPads -->
<link href="/assets/images/apple-touch-icon-xlarge.png" rel="apple-touch-icon-precomposed" sizes="144x144" type="image/png"/>
<!-- For retina-display iPhones -->
<link href="/assets/images/apple-touch-icon-large.png" rel="apple-touch-icon-precomposed" sizes="114x114" type="image/png"/>
<!-- For iPad 1 -->
<link href="/assets/images/apple-touch-icon-medium.png" rel="apple-touch-icon-precomposed" sizes="72x72" type="image/png"/>
<!-- For iPhone 3G, iPod Touch and Android -->
<link href="/assets/images/apple-touch-icon-small.png" rel="apple-touch-icon-precomposed" type="image/png"/>
<!-- For Nokia -->
// currying example
function add(n) {
// save results
var r = 0;
// the real deal
function _add(n) {
r += n;
document.getElementById('r').innerHTML = r;
// return add interface
return _add;
@natos
natos / dabblet.css
Created August 7, 2013 15:26
Untitled
h1 {
font-size: 32px
}
@natos
natos / sortByDateTiem
Last active February 27, 2016 11:01
Sort array by datetime
// Let's say you have collection of things, like:
var collection = [
{name: '#1 thing', time: '2012-03-16T07:22Z'},
{name: '#2 thing', time: '2012-03-15T12:00Z'},
{name: '#3 thing', time: '2012-03-17T20:25Z'},
{name: '#4 thing', time: '2012-03-13T13:45Z'}
];
// the sorting function
function sortByDateTime(a, b) {
@natos
natos / api_example.js
Last active February 27, 2016 11:40
JavaScript API example
var API = (function () {
// private scope
var API_PREFIX = 'http://api.myapp.com';
// request helper
function _request (method, resource, data, succes, error) {
// use your favorite library here
// or just vanilla...
var options = {
url: API_PREFIX + resource,
type: method,
@natos
natos / __request
Created March 8, 2012 15:23
Multiple Requests with Request (Node.js)
var request = require('request')
/**
* Handle multiple requests at once
* @param urls [array]
* @param callback [function]
* @requires request module for node ( https://github.com/mikeal/request )
*/
var __request = function (urls, callback) {