Skip to content

Instantly share code, notes, and snippets.

View jancassio's full-sized avatar
:octocat:
Loading...

Jan Cassio jancassio

:octocat:
Loading...
View GitHub Profile
@jancassio
jancassio / Dispatcher.js
Last active May 16, 2016 18:28
JavaScript Dispatcher
/**
* Dispatcher
* Author: Jan Cassio <[email protected]>
*
* A small event dispacher helper for general usage.
*/
var Dispatcher = {
events: {},
/**
* Emit an event that can be handled by subscribed handlers.
// The MIT License (MIT)
// Copyright (c) 2014 Jan Cássio
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jancassio
jancassio / README.md
Last active August 29, 2015 14:22
Stupid simple function to log messages formatted with time, class, function and line number on Xcode console like a boss!
@jancassio
jancassio / UIButton+EventBlocks.h
Last active April 13, 2017 15:04
Simple UIButton Category to Support Event Blocks
// The MIT License (MIT)
// Copyright (c) 2014 Jan Cássio
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@jancassio
jancassio / About.mkd
Last active August 29, 2015 14:01
A very simple GAI + Flurry tracker.

#iOS Google Analytics and Flurry Tracker

This is a very simple helper track GAI and Flurry screen views and events quickly. Of course, you can customize based on marketing plan to increase tracking precision.

Starting tracker

Before use the Tracker, you need to initialize then, the best place to do this is in your AppDelegate file, at application:didFinishLaunchingWithOptions:launchOptions callback.

@jancassio
jancassio / str_cmpr.js
Created June 15, 2011 16:22
JavaScript String compare
/**
* Compare a string (a la c) with other and return -1 if smaller, 0 if equals or 1 if higher
* @author: Jan Cássio | [email protected]
* @usage
* "cupcake".compare("chocolate"); // returns 1;
* "sounds good".compare("sounds good"); // return 0;
* "10.1".compare("10.105"); // returns -1;
*/
String.prototype.compare = function(other)
{
@jancassio
jancassio / string_format.js
Last active September 26, 2015 00:28
Very simple string format in JavaScript
/**
* Simple string format.
* @author: Jan Cássio | [email protected]
* @usage
* "{0} World, my name is {1}".format("Hello", "Jan"); // returns "Hello world, my name is Jan";
*/
String.prototype.format = function()
{
var i, result, pattern;