Skip to content

Instantly share code, notes, and snippets.

View jankuca's full-sized avatar

Jan Kuča jankuca

  • Prague, Czech Republic
  • 01:37 (UTC +02:00)
View GitHub Profile
@jankuca
jankuca / es6-classes.js
Last active October 10, 2015 10:32
Classes vs. Factories
class Dispatcher {
register(listener) {
this.listener = listener;
}
dispatch(action) {
if (this.listener) {
this.listener(action);
}
@jankuca
jankuca / tag-helpers.js
Last active August 29, 2015 14:21 — forked from ofstudio/heplers.js
var hbs = require('express-hbs'),
api = require('core/server/api'),
_ = require('lodash'),
async = require('express-hbs/lib/async'), // To redefine `registerAsyncHelper`
registerAsyncHelper;
// Redefine `registerAsyncHelper` from `express-hbs`
registerAsyncHelper = function (name, fn) {
hbs.handlebars.registerHelper(name, function (context, options) {
// Pass `[context, options]` as arg instead of `context` only
module.exports = function (Handlebars) {
/*! ******************************
Handlebars helpers
*******************************/
// debug helper
// usage: {{debug}} or {{debug someValue}}
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/)
Handlebars.registerHelper("debug", function(optionalValue) {
console.log("Current Context");
# List all installed Apple Developer certificates
security find-certificate -a -c "Developer" login.keychain | grep '"labl"' | cut -d'"' -f4
# List installed .mobileprovision files
ls ~/Library/MobileDevice/Provisioning\ Profiles/
# Get plist from a .mobileprovision file
openssl smime -inform der -verify -noverify -in $mobileprovision_file
#!/bin/sh
REPO_DIRNAME=$PWD
REPO_BASENAME=$(basename $REPO_DIRNAME)
REPO_BASENAME=${REPO_BASENAME%.git}
if [ $REPO_BASENAME = "gitolite-admin" ]; then
$a = function () {
echo 'x';
};
$a();
@jankuca
jankuca / vkontakte.js
Created September 18, 2012 08:19
VKontakte Audio Search
goog.provide('VKontakte');
goog.require('goog.crypt.Md5');
VKontakte = function (user_id, app_id, app_secret) {
this.user_id_ = user_id;
this.app_id_ = app_id;
this.app_secret_ = app_secret;
};
- (void)connect {
NSHost *host = [NSHost hostWithName:@"example.com"];
// iStream and oStream are instance variables
[NSStream getStreamsToHost:host port:2000 inputStream:&iStream
outputStream:&oStream];
[iStream retain];
[oStream retain];
[iStream setDelegate:self];
[oStream setDelegate:self];
@jankuca
jankuca / api-controller.js
Created August 27, 2012 19:22
Controller proposal
function ApiController() {
Controller.call(this);
}
ApiController.prototype = Object.create(Controller.prototype);
ApiController.prototype.error = function (status, message) {
this.render(status, { 'error': message });
};
@jankuca
jankuca / IndexController.js
Created July 27, 2012 12:12
Darkside Form Implementation Draft
var darkside = require('darkside');
var IndexController = function () {
darkside.base(this, darkside.ViewController);
};
util.inherits(IndexController, darkside.ViewController);