Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
import base64 | |
from django.utils import simplejson | |
import urllib | |
from google.appengine.api import urlfetch | |
def track(event, properties=None): | |
""" | |
A simple function for asynchronously logging to the mixpanel.com API on App Engine | |
(Python) using RPC URL Fetch object. | |
@param event: The overall event/category you would like to log this data under |
#define ApplicationDelegate ((MyAppDelegate *)[[UIApplication sharedApplication] delegate]) | |
#define UserDefaults [NSUserDefaults standardUserDefaults] | |
#define SharedApplication [UIApplication sharedApplication] | |
#define Bundle [NSBundle mainBundle] | |
#define MainScreen [UIScreen mainScreen] | |
#define ShowNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = YES | |
#define HideNetworkActivityIndicator() [UIApplication sharedApplication].networkActivityIndicatorVisible = NO | |
#define NetworkActivityIndicatorVisible(x) [UIApplication sharedApplication].networkActivityIndicatorVisible = x | |
#define NavBar self.navigationController.navigationBar | |
#define TabBar self.tabBarController.tabBar |
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
// use window.btoa' step. According to my tests, this appears to be a faster approach: | |
// http://jsperf.com/encoding-xhr-image-data/5 | |
/* | |
MIT LICENSE | |
Copyright 2011 Jon Leighton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
require 'net/https' | |
require 'nokogiri' | |
url = "https://example.com" | |
url = URI.parse( url ) | |
http = Net::HTTP.new( url.host, url.port ) | |
http.use_ssl = true if url.port == 443 | |
http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url.port == 443 | |
path = url.path | |
path += "?" + url.query unless url.query.nil? |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
# ANDROID / ECLIPSE | |
# built application files | |
*.apk | |
*.ap_ | |
# files for the dex VM | |
*.dex | |
# Java class files |
RubyMotion comes with some syntax idioms that are not strictly idiomatic Ruby.
For example, in an iOS app we'd often see these two methods defined in a subclass of UITableViewController
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// callback code for selecting table rows goes here...
// Copyright 2012 Square, Inc. | |
package com.squareup.widgets; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.ImageView; | |
/** Maintains an aspect ratio based on either width or height. Disabled by default. */ | |
public class AspectRatioImageView extends ImageView { |
Hi. My name is Sadayuki "Sada" Furuhashi. I am the author of the MessagePack serialization format as well as its implementation in C/C++/Ruby.
Recently, MessagePack made it to the front page of Hacker News with this blog entry by Olaf, the creator of the Facebook game ZeroPilot. In the comment thread, there were several criticisms for the blog post as well as MessagePack itself, and I thought this was a good opportunity for me to address the questions and share my thoughts.
To the best of my understanding, roughly speaking, the criticisms fell into the following two categories.
# 1/ Read EXIF orientation flag | |
identify -format "%[EXIF:orientation]" myimage.jpg | |
# NOTE: jhead can be used too | |
# see http://www.sentex.net/~mwandel/jhead/ | |
jhead -exifmap myimage.jpg | grep Ori | |
# 2/ Remove EXIF orientation | |
# i.e. rotate the image accordingly and reset the orientation | |
# flag to 1 (default, i.e. origin = TopLeft) |