Skip to content

Instantly share code, notes, and snippets.

- (void)drawBevelArea
{
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = UIGraphicsGetCurrentContext();
CGRect frame = self.frame;
CGRect bevelAreaRect = CGRectMake(0, 0, frame.size.width, frame.size.height);
UIBezierPath* bevelAreaPath = [UIBezierPath bezierPathWithRoundedRect:bevelAreaRect cornerRadius:_cornerRadius];
[_bevelBackgroundColor setFill];
@clooth
clooth / TimestampToDate.scpt
Created July 9, 2013 09:27
Applescript to display real date of selected timestamp
on run {input, parameters}
tell application "System Events"
set activeApp to name of first process whose frontmost is true
end tell
set _timestamp to (input as string)
tell application activeApp
set realDate to ((do shell script "date -r " & _timestamp) as string)
static inline double radians (double degrees) {return degrees * M_PI/180;}
CGImageRef CreateRotatedImage(CGImageRef imageRef, UIImageOrientation orientation)
{
CGRect bnds = CGRectZero;
CGImageRef copy = nil;
CGContextRef ctxt = nil;
CGRect rect = CGRectZero;
CGAffineTransform tran = CGAffineTransformIdentity;
@clooth
clooth / pttrns.rb
Created April 25, 2013 09:16
pttrns.com downloader
require 'nokogiri'
require 'open-uri'
require 'net/http'
# Patterns
patterns = {}
# Load first page
doc = Nokogiri::HTML(open('http://pttrns.com/'))
@clooth
clooth / mobilepatterns.rb
Created April 25, 2013 09:15
mobile-patterns.com downloader
require 'nokogiri'
require 'open-uri'
require 'net/http'
# Patterns
patterns = {}
# Load first page
doc = Nokogiri::HTML(open('http://www.mobile-patterns.com/'))
@clooth
clooth / demo.coffee
Created March 18, 2013 03:27
Diesel demo source
#
# Vision of how Diesel works
#
# Initialize engine from singleton
game = D.Game.get
title: "Chain Reaction Game v1.0"
container: document.querySelector('#game')
@clooth
clooth / demo.coffee
Created March 17, 2013 20:55
Example how Diesel.js works
#
# Vision of how Diesel works
#
# Initialize engine from singleton
game = DGame.get
title: "Chain Reaction Game v1.0"
container: document.querySelector('body')
class DemoState extends DGameState
@clooth
clooth / frames.m
Created February 17, 2013 21:47
Dynamic three row label framing and display
// Available coordinates for article text display
CGFloat textDisplayStartX = self.photoView.frame.origin.x + self.photoView.frame.size.width + 10.0;
CGFloat textDisplayWidth = self.frame.size.width - textDisplayStartX - 5.0;
// Line heights
CGFloat titleLabelLineHeight = self.articleTitleLabel.font.lineHeight;
CGFloat detailLabelLineHeight = self.articleDetailsLabel.font.lineHeight;
CGFloat previewLabelLineHeight = self.articlePreviewLabel.font.lineHeight;
// Calculate title label size to determine whether to show the other labels or not
@clooth
clooth / moments.coffee
Created February 13, 2013 14:07
Moments splash animation
# Moments splash page
# (c) momentsapp.com
jQuery ->
# Set up elements required
$container = $('#canvas')
# Set up raphael and the moments circles
paper = new Raphael(
#sitecontainer{background:0}#body{background:rgba(0,0,0,.8)}#viewprevnexttop table td a,.viewprevnext table td a{color:#fff!important;text-shadow:none}.sharebutton,.sharebutton a{border-radius:5px}#linkinfo{color:#fff}#linkdatacontainer a{color:#26a5f9}.addthis_button{display:none}.tag_suggestion{display:inline-block;margin:5px;color:#fff}#newtagsuggestioninput{padding:5px!important}h1.line{border:0;color:#fff}.list_comments table tr td.tools{border:0!important}.list_comments .content .comment_content{color:#fff!important}.list_comments td.author .user em{color:#555}.list_comments td.author .user b{color:#fff}.list_comments table tr td.tools a:hover{color:#fff}.list_comments table tr td.author_photo,.list_comments table tr td.author_photo img{border-radius:5px}.list_comments table tr td.content .quote{border:0}#viewbody{background:0}#header2012-main{background:0;text-shadow:none}#header2012-main ul li,#header2012-main ul li a{background:0;border:0;color:#fff!important;text-shadow:1px 1px 2px #000}#header2012-