Skip to content

Instantly share code, notes, and snippets.

@0m15
0m15 / videos.json
Created March 16, 2011 15:39
sample JSON file
{
"videos" : [
{
"videoId" : "ID",
"title" : "title"
"streamingURL" : "http://www.url-to-video.it/video.mp4",
"publishDate" : "MM/GG/AAAA HH:mm",
"tags" : ["tag1", "tag2", "tag3"],
"abstract" : "abstract",
}
@0m15
0m15 / test.js
Created January 12, 2012 20:32
test 02
var x = 1;
x++;
@0m15
0m15 / paginated_collection.js
Created June 22, 2012 22:50 — forked from io41/paginated_collection.js
Pagination with Backbone.js
// includes bindings for fetching/fetched
var PaginatedCollection = Backbone.Collection.extend({
initialize: function() {
_.bindAll(this, 'parse', 'url', 'pageInfo', 'nextPage', 'previousPage');
typeof(options) != 'undefined' || (options = {});
this.page = 1;
typeof(this.perPage) != 'undefined' || (this.perPage = 10);
},
fetch: function(options) {
@0m15
0m15 / i18n.coffee
Created June 22, 2012 22:51 — forked from madrobby/i18n.coffee
Backbone i18n with CoffeeScript
# before this file is loaded, a locale should be set:
#
# In a browser environment, you can use:
# ```<script>__locale='en';</script>```
#
# In a server environment (specifically node.js):
# ```global.__locale = 'en';```
# normalize in-app locale string to "en" or "de-AT"
parts = @__locale.split('-')
.main code {
font-size: 14px;
font-family: 'Droid Sans Mono', 'PT Mono';
}
.main pre {
padding: 0px 20px;
border: 1px solid #ddd;
}
.main blockquote {
border-left: 2px solid #ff6600;
@0m15
0m15 / mongo_chunk.py
Last active March 7, 2018 19:42
Python script that can export Mongo collections of any size into progressive numbered json chunks, type `python mongo_chunk.py --help` to have a list of available options
#!/usr/bin/python
import argparse
from pymongo import MongoClient as Client
from bson import BSON
from bson import json_util
import json
import os
# mongo client
`/** @jsx React.DOM */`
# Component structure:
# - DropdownButton
# - DropdownMenu
# - DropdownMenuItem
# refs to some utils
classSet = React.addons.classSet
@0m15
0m15 / Carousel.coffee
Last active March 25, 2020 13:28
A ReactJS based carousel. No dom manipulation, no jQuery, all based on ReactJS states and intelligent rendering and the aid of `ReactCSSTransitionGroup`. Check also the css: https://gist.github.com/zimok/10018721
// sketch.scriptPath is an absolute path from ~ to the parent directory of the .sketchplugin
var pluginPath = sketch.scriptPath.substring(0, sketch.scriptPath.lastIndexOf('/'));
var baseUrl = 'https://api.spotify.com/v1'
var el = getArray();
if (el != null) {
var alert = createAlertBase('spotify');
alert.setMessageText("Options");