Skip to content

Instantly share code, notes, and snippets.

[PRTween tween:self property:@"alpha" from:1.0 to:0.0 duration:.250 timingFunction:&PRTweenTimingFunctionCubicInOut updateBlock:nil completeBlock:^{
[self setHidden:YES];
}];
@chrisallick
chrisallick / Base64 JS Demo
Last active June 29, 2021 18:47
Base64 in JavaScript turn a json object to a base64 string. boom!
<!DOCTYPE html>
<html>
<head>
<title>Base64 Demo</title>
<meta charset="utf-8">
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js' type='text/javascript'></script>
<script src='https://javascriptbase64.googlecode.com/files/base64.js' type='text/javascript'></script>
@chrisallick
chrisallick / getJSONObjectiveC
Created March 5, 2013 22:14
Retrieve JSON in iOS 6. It's that simple.
Sinatra:
get '/messages' do
content_type :json
messages = []
all = $redis.lrange("messages", 0, $redis.llen("messages"))
all.each do |message|
messages.push( message )
end
{ :result => "success", :messages => messages }.to_json
@chrisallick
chrisallick / SettingsView.m
Last active December 14, 2015 16:19
Custom UIView with Background Image and Navigation Bar.
//
// SettingsView.m
// lastapp
//
// Created by Christopher Allick on 3/5/13.
// Copyright (c) 2013 Goon & Goblin. All rights reserved.
//
#import "SettingsView.h"
error: PCH file built from a different branch ((clang-425.0.24)) than the compiler ((clang-425.0.27))
@chrisallick
chrisallick / gist:5206206
Created March 20, 2013 16:44
fishfish show git branch in shell
set fish_git_dirty_color red
function parse_git_dirty
git diff —quiet HEAD ^&-
if test $status = 1
echo (set_color $fish_git_dirty_color)"Δ"(set_color normal)
@chrisallick
chrisallick / buildnumber.js
Last active December 17, 2015 05:49
Check phone number input and add "-" while allowing delete
buildNumber = function() {
var text = $("#phonenumber").val();
var new_text = "";
if( text.length < 3 || (text.length > 3 && text.length < 7) || text.length > 7 ) {
new_text = text;
} else if( text.length == 3 || text.length == 7 ) {
new_text = text + "-";
}
@chrisallick
chrisallick / events.rb
Created May 19, 2013 01:55
event registration and triggering ruby
@@events = {}
def addEvent( event, type, function )
@@events[event] = {}
@@events[event]["type"] = type
@@events[event]["function"] = function
end
addEvent("compass", String, lambda{|msg|
puts "#{msg} world"
@chrisallick
chrisallick / coolbeans.m
Created May 21, 2013 00:28
I investigated dictionaries and blocks in objective-c to match my javascript and ruby library that stores event callbacks in a dictionary.
//
// ViewController.m
// BlockTest
//
// Created by chrisallick on 5/20/13.
// Copyright (c) 2013 chrisallick. All rights reserved.
//
#import "ViewController.h"
@chrisallick
chrisallick / events.py
Created May 21, 2013 01:27
not happy with this, but lambdas are only a single line and you cannot pass anonymous functions in python :(
from __future__ import print_function
events = {}
def fireEvent(event,msg):
events[event](msg)
def addEvent(event,type,func):
events[event] = func