Skip to content

Instantly share code, notes, and snippets.

@alonecuzzo
alonecuzzo / FunctionalOfFuture.swift
Last active August 29, 2015 14:26
Code from Functional Presentation
// paperlesspost.com/api/v100/event?id=3948
//{
// id: 3948,
// eventName: "The Party For the LOLZ",
// hostName: "datFoolCuzzo"
//
//}
protocol JSONDecodable {
static func decode(json: JSON) -> Self?
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
if (!self.tabBarIsShowing) {
self.tabBar.hidden = YES;
}
}
txtblk='\e[0;30m' # Black - Regular
txtred='\e[0;31m' # Red
txtgrn='\e[0;32m' # Green
txtylw='\e[0;33m' # Yellow
txtblu='\e[0;34m' # Blue
txtpur='\e[0;35m' # Purple
txtcyn='\e[0;36m' # Cyan
txtwht='\e[0;37m' # White
bldblk='\e[1;30m' # Black - Bold
bldred='\e[1;31m' # Red
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)
fact(i)
{
if(i > 1)
return i*fact(i-1);
else
return 1;
}
fact(i)
{
return i*fact(i-1);
}
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
int arr[10] = {3, 9, 15, 3, 9, 6, 6, 3, 15, 5};
PrintSpecialAverage(arr, sizeof(arr) / sizeof(arr[0]));
}
void PrintSpecialAverage(int arr[], int arrlen)
{
@alonecuzzo
alonecuzzo / gist:7443632
Last active December 28, 2015 04:39
factorial code - non recursive
fact(i)
{
int f = 1;
for(j=1;j<=i;j++)
f *= j;
return f;
}
//
// LORichTextLabel.m
// RichTextLabel
//
// Created by Locassa on 19/06/2011.
// Copyright 2011 Locassa Ltd. All rights reserved.
//
#import "LORichTextLabel.h"
#import "UIView+Layout.h"
@alonecuzzo
alonecuzzo / gist:5172038
Created March 15, 2013 18:41
Here's how they create a hitArea/hitRadius in the /assets/SpaceRock.js file in the examples folder.
p.hitPoint = function (tX, tY) {
return this.hitRadius(tX, tY, 0);
}
p.hitRadius = function (tX, tY, tHit) {
//early returns speed it up
if (tX - tHit > this.x + this.hit) {
return;
}