Skip to content

Instantly share code, notes, and snippets.

Working from home

Andrey Tkachenko falkolab

Working from home
  • Russian Federation
View GitHub Profile
slavafomin /
Last active November 25, 2022 06:18
Custom ES6 errors in Node.js

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors



Important: At the time of writing (2019-11-11) Immutable.js is effectively abandonware, so I can no longer recommend anyone to follow the advice given here. I'll leave the article here for posterity, since it's still getting some traffic.

Understanding Immutable.Record

Functional programming principles and with it immutable data are changing the way we write frontend applications. If the recent de-facto frontend stack of React and Redux feels like it goes perfectly together with immutable data, that's because it's specifically designed for that.

There's several interesting implementations of immutable data for JavaScript, but here I'll be focusing on Facebook's own Immutable.js, and specifically on one of i

savelee / CLI
Last active February 13, 2017 07:38
SENCHA: How to generate a starter app based on a template
View CLI
//navigate to the ext js 6 folder
sencha package upgrade
sencha generate app -s templates/admin-dashboard/ Dashboard ../my-folder
jasonkneen / elements.js
Last active November 28, 2016 14:26
In the latest TiAlloy you can specify a module tag against the <Alloy> element in XML and this will be used when creating any elements in the view, so you can override, customise etc. The problem is if you want to use multiple commonJS libraries, there's no support in the Alloy Tag -- you'd have to change the module attribute for each element --…
View elements.js
var o = {};
// include the modules you want - purposely did this as seperate lines so it's easier to comment out modules etc
_.extend(o, require("module1"));
_.extend(o, require("module2"));
_.extend(o, require("module3"));
// make available under a single export for use in <Alloy> tag
module.exports = o;
robvanoostenrijk /
Last active September 15, 2021 21:55
Install Mac OS X 10.6 SDK on newer Xcode
dextorer / strip.conf
Created July 6, 2014 13:01
View strip.conf
tonylukasavage / app.js
Created June 2, 2014 14:51
Inject environment variables into Titanium. Makes shared code easier to manage (no more sanitizing keys in repos). Uses Titanium to encrypt the values.
View app.js
// now you can use it in a titanium app
tonylukasavage / base.js
Created August 5, 2013 19:31
inheriting event handlers in Alloy
View base.js
// The base controller event handler, which will get overridden by the derived one
exports.doClick = function(e) {
alert('base click handler');
// We have to wait until the object is initialized before applying the event listener. This is so
// the derived listener is used, not the base one. Also, "$" must be used instead of "exports", to
// ensure that the overridden instance of the controller's "doClick" is used, not the exported
// version of the function from the base controller.
exports.init = function(e) {
Mithrandir0x / gist:3639232
Created September 5, 2012 16:15
Difference between Service, Factory and Provider in AngularJS
View gist:3639232
// Source:!topic/angular/hVrkvaHGOfc
// jsFiddle:
// author: Pawel Kozlowski
var myApp = angular.module('myApp', []);
//service style, probably the simplest one
myApp.service('helloWorldFromService', function() {
this.sayHello = function() {
return "Hello, World!"
View platform.js
//single calls over bridge
var osname = Ti.Platform.osname,
version = parseInt(Ti.Platform.version);
//simple boolean checks
var isandroid = function() {
return osname === 'android';
var isios = function() {