Skip to content

Instantly share code, notes, and snippets.

E.add('loan-calculator-flash', 'click', function (event) {
E.preventDefault(event);
swfobject.embedSWF("/assets/calc/calculator.swf", "flashcontentLoan", "870", "540", "8.0.0", "expressInstall.swf", {
'url': "/assets/calc/loan.swf",
'calc': "Loan",
'LowAPR': C.getLowAPR(),
'HighAPR': C.getHighAPR(),
'LoanAmount': C.getLoanAmount(),
'term': C.getTerm(),
'debtList': C.getCreditorAmount(),
@alonecuzzo
alonecuzzo / rc4.py
Created November 9, 2012 20:57
My RC4 attempt
class RC4(object):
#initilization- take in the key and assign it
def __init__(self, key):
self._key = key
def _setKey(self, key):
self._key = key
@alonecuzzo
alonecuzzo / db.c
Created November 26, 2012 22:03
exiting with a return value other than zero
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#define MAX_DATA 512
#define MAX_ROWS 100
struct Address {
@alonecuzzo
alonecuzzo / gist:4250902
Created December 10, 2012 14:38
Quit Adium After 15 minutes of Idle Time
global quit_after, check_every
set quit_after to 900
set check_every to 10
display dialog "Check is performed every " & check_every & " seconds. Adium will be quit after " & quit_after & " seconds of system inactivity."
on reopen
display dialog "Check is performed every " & check_every & " seconds. Adium will be quit after " & quit_after & " seconds of system inactivity."
end reopen
@alonecuzzo
alonecuzzo / gist:4286396
Created December 14, 2012 15:52
This can be used to delete a specific event from a Backbone View. It basically solves the issue of not being able to specify an even to undelegate.
//from inside the view
undelegateEvent: function(event) {
this.undelegateEvents();
var events = _.clone(this.events);
delete events.event;
this.delegateEvents(events);
}
class CustomTableHeaderView: UIView {
//MARK: Property
let label = UILabel(frame: CGRectZero)
let backbutton = UIButton(frame: CGRectZero)
//MARK: Method
override init(frame: CGRect) {
super.init(frame: frame)
@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;
}
//
// 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: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;
}
{
[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)
{