Skip to content

Instantly share code, notes, and snippets.

@0m15
0m15 / shorter-git-commit-proposal.md
Last active February 5, 2020 10:03
A shorter, easy to read git commit message format syntax

Premise

I find it tedious to write commit messages. The common practice is to use a verbose commit message, where the first word is a verb describing what the commit did do, for example:

  • Add editable title on <ArticleEdit /> component
  • Hotifx: Handle authentication failed for expired token
  • Fix typo in about us page
  • Remove unused css
@0m15
0m15 / SketchSystems.spec
Last active November 9, 2018 17:27
Photo App*
Photo App*
Splash Screen*
loaded -> Select Source
Select Source
allow camera -> Take Picture
allow library -> Snapshot
Take Picture
// 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");
@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
`/** @jsx React.DOM */`
# Component structure:
# - DropdownButton
# - DropdownMenu
# - DropdownMenuItem
# refs to some utils
classSet = React.addons.classSet
@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
.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 / 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('-')
@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) {