This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 9 out of 10 microbenchmarks agree: implicit return smokes explicit return | |
require 'benchmark' | |
def explicit | |
return 1 | |
end | |
def implicit | |
1 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.m | |
// CarsGalore | |
// | |
// Copyright (c) 2014 Cloudmine. All rights reserved. | |
// | |
// This is a sample application which shows how to have users and data | |
// in one app but push notifications are coming from a shared app that | |
// is responsible for sending multiple applications notifications. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.m | |
// CarsGalore | |
// | |
// Copyright (c) 2014 Cloudmine. All rights reserved. | |
// | |
// This is a sample application which shows how to have users and data | |
// in one app but push notifications are coming from a shared app that | |
// is responsible for sending multiple applications notifications. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Escapist() { | |
} | |
// escapeXml escapes XML, but not HTML because HTML does not know & apos;. | |
// However most browsers also support & apos; in HTML documents.IE is not most browsers. | |
Escapist.prototype.escapeHTML = function (str) { | |
var htmlCharMap = { | |
'<': '<', | |
'>': '>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get update | |
sudo apt-get install openjdk-6-jre-headless -f | |
sudo apt-get install curl | |
sudo apt-get install unzip | |
sudo apt-get install openssh-server | |
sudo curl -OL http://github.com/downloads/elasticsearch/elasticsearch/elasticsearch-0.19.8.zip | |
sudo unzip elasticsearch-* && rm elasticsearch-*.zip | |
cd elasticsearch-0.19.8 | |
sudo mkdir /usr/local/elasticsearch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine | |
# This is how I upload my new Sol Trader builds (http://soltrader.net) | |
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash | |
S3KEY="my aws key" | |
S3SECRET="my aws secret" # pass these in | |
function putS3 | |
{ | |
path=$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Drawing; | |
using MonoTouch.UIKit; | |
using MonoTouch.Foundation; | |
using MonoTouch.CoreGraphics; | |
public class SplatClearToolbar: UIToolbar | |
{ | |
UIViewController vc; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static UIImage RotateImage (this UIImage image) | |
{ | |
if (image.Orientation == UIImageOrientation.Up) return image; | |
UIGraphics.BeginImageContextWithOptions(image.Size, false, image.CurrentScale); | |
iimage.DrawAsPatternInRect(new RectangleF(0, 0, image.Size.Width, image.Size.Height)); | |
UIImage normalizedImage = UIGraphics.GetImageFromCurrentImageContext(); | |
UIGraphics.EndImageContext(); | |
return normalizedImage; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSTimer timer; | |
UIAlertView alertView = new UIAlertView ("test", "Testing the animation\n ", null, null, new string[] {}); | |
alertView.Presented += (object sender, EventArgs e) => { | |
using (var pool = new NSAutoreleasePool()) | |
{ | |
timer = NSTimer.CreateRepeatingScheduledTimer(1, delegate { | |
if (alertView.Message.EndsWith("...")) | |
{ | |
string newMessage; | |
newMessage = alertView.Message.Remove (alertView.Message.Length - 3); |
OlderNewer