Skip to content

Instantly share code, notes, and snippets.

View bartek's full-sized avatar
🐗

Bartek Ciszkowski bartek

🐗
View GitHub Profile
@bartek
bartek / -
Created September 26, 2014 14:21
{"id": "35921", "href": "https://rest.gadventures.com/promotions/35921", "name": "Last Minute 10% off CRPJ141102", "promotion_code": "LM10CRPJ141102", "discount_amount": null, "discount_percent": "10.00", "commission_rate": null, "min_travellers": 0, "sale_start_date": "2014-09-02", "sale_finish_date": "2014-10-02", "product_start_date": null, "product_finish_date": null, "terms_and_conditions": null, "currencies": ["CAD", "CHF", "EUR", "AUD", "USD", "GBP", "NZD", "ZAR"], "room_codes": null, "flags": ["APPLY_AUTOMATICALLY"], "products": [{"id": "506398", "href": "https://rest.gadventures.com/departures/506398", "type": "departures", "sub_type": "Tour"}]}
$el = $("my-input");
var checkLength = function(input) { if (input.length > 40) { return true } return false; }
var validateEmailAddress = function(input) { return ... }
var rules = [
checkLength,
validateEmailAddress
];
@bartek
bartek / nose-testrunner.py
Created June 5, 2014 20:35
tests/noserunner.py standard for allowing integration and unittest separation.
import nose
from nose.plugins.base import Plugin
class IntegrationSelector(Plugin):
def options(self, parser, env):
parser.add_option("--exclude-integration",
dest="integration", action="store_false",
default=None)
parser.add_option("--integration",
dest="integration", action="store_true",
function InvalidFieldException(message) {
this.message = (message || "");
this.name = 'InvalidFieldException';
this.stack = (new Error()).stack;
}
InvalidFieldException.prototype = Error.prototype;
// throw new InvalidFieldException("...")
function getSomethingMagicalFromRemote() {
var obj = cache.get('obj-key');
if (typeof obj =!="undefined")
return obj
}
// Otherwise init ajax call
$.ajax({ .... })
}
@bartek
bartek / dict_to_xml.py
Created April 17, 2014 19:39
Convert a list of dictionaries into an XML representation
from xml.etree.ElementTree import Element, SubElement
def dict_to_xml(data, root_name='events'):
# a list of dictionaries, converted into xml.
root = Element(root_name)
def _make_xml(i_root, data_dict):
for field, val in data_dict.iteritems():
if isinstance(val, dict):
i_data = SubElement(i_root, field)
{
"name": "profile",
"version": "0.0.1",
"description": "Profile application, codenamed MyG",
"main": "app/main.js",
"browserify-shim": {
"backbone": "Backbone",
"backbone-nested": {"depends": ["backbone"]}
},
"browserify": {
from django.db.models.query import QuerySet
from django.db import models
class QuerySetManager(QuerySet):
'''
Subclass this class to define custom Managers with chainable, custom
QuerySet calls.
For example, define your queryset subclassing this object:
diff --git a/src/template-jasmine-requirejs.js b/src/template-jasmine-requirejs.js
index ddb021d..1ecdb54 100644
--- a/src/template-jasmine-requirejs.js
+++ b/src/template-jasmine-requirejs.js
@@ -56,8 +56,15 @@ exports.process = function(grunt, task, context) {
// Remove baseUrl and .js from src files
var baseUrl = (context.options.requireConfig && context.options.requireConfig.baseUrl || '/');
+ var paths = (context.options.requireConfig && context.options.requireConfig.paths || {});
+

Make it real

Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discussions around concrete examples, not handy-waving abstractions. Don't say you did something, provide a URL that proves it.

Ship it

Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.

Do it with style