Skip to content

Instantly share code, notes, and snippets.

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

Jan Cássio jancassio

:octocat:
Loading...
View GitHub Profile
@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 | hey@jancassio.com
* @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;
@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 | hey@jancassio.com
* @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 / 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 / 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 / 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!
// 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 / Dispatcher.js
Last active May 16, 2016 18:28
JavaScript Dispatcher
/**
* Dispatcher
* Author: Jan Cassio <hey@jancassio.com>
*
* A small event dispacher helper for general usage.
*/
var Dispatcher = {
events: {},
/**
* Emit an event that can be handled by subscribed handlers.
@jancassio
jancassio / xcode_ramdisk.sh
Created June 14, 2016 22:13 — forked from skeeet/xcode_ramdisk.sh
Create a RAM disk for using with XCode
#!/bin/sh
# Create a RAM disk with same perms as mountpoint
# Script based on http://itux.idev.pro/2012/04/iservice-speed-up-your-xcode-%D0%BD%D0%B5%D0%BA%D0%BE%D1%82%D0%BE%D1%80%D1%8B%D0%B5-%D1%81%D0%BF%D0%BE%D1%81%D0%BE%D0%B1%D1%8B/ with some additions
# Usage: sudo ./xcode_ramdisk.sh start
USERNAME=$(logname)
TMP_DIR="/private/tmp"
RUN_DIR="/var/run"
SYS_CACHES_DIR="/Library/Caches"
@jancassio
jancassio / StringMaskr.swift
Created August 19, 2016 17:43
Simple string formatter based on mask string
//
// StringMask.swift
// StringMask
//
// Created by Jan Cássio on 8/19/16.
// Copyright © 2016 Jan Cassio. All rights reserved.
//
import Foundation
@jancassio
jancassio / GoogleMapsLinkBuilder.swift
Created November 18, 2016 17:07
A simple protocol and some concrete implementations to generate links to be opened in some of common Map based apps for iOS
// The MIT License (MIT)
// Copyright (c) 2016 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: