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
#!/bin/bash | |
# Install VirtualBox Guest Additions | |
# (change ARCH and VERSION as needed) | |
# run it as root or with sudo | |
ARCH="x86" | |
VERSION="3.2.6" | |
FILE="VBoxGuestAdditions_${VERSION}.iso" | |
URL="http://download.virtualbox.org/virtualbox/${VERSION}/${FILE}" | |
cd /tmp | |
wget "$URL" |
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
#!/usr/bin/env bash | |
set -e | |
ME=$0 | |
SSH_USER=$1 | |
HOST=$2 | |
SSH_TO="$SSH_USER@$HOST" | |
PASSWORD="${PASSWORD:-chefchefchef}" | |
USE_SUDO="${USE_SUDO:-yes}" |
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
require 'rubygems' | |
require 'vagrant' | |
module Vagrant | |
class SSH | |
def rsync(opts={}) | |
if Mario::Platform.windows? | |
raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path, | |
:ssh_port => port(opts) | |
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
# `asset-data-url` sass helper | |
# quick fix for: https://github.com/rails/sass-rails/pull/46 | |
unless Sass::Script::Functions.method_defined?(:asset_data_url) | |
module Sass | |
module Extra | |
module Helpers | |
def asset_data_url(path) | |
data = context_asset_data_uri(path.value) | |
Sass::Script::String.new(%Q{url(#{data})}) |
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
// the biggest problem i've faced in "big" js apps (one-page RIAs, mobile and web) | |
// is the javascript stack. avoid diving deep as much as possible. basically | |
// a function that calls a function that calls a function within a loop is a | |
// really really bad idea. especially on mobile devices that typically don't have | |
// a stack limit as big as a normal browser. | |
var books = [ | |
{ name: "A", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] }, | |
{ name: "B", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] }, | |
{ name: "C", chapters: [ { name: "X" }, { name: "Y" }, { name: "Z" } ] }, |
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
# read entitlements from the provisioning_profile | |
# you can the set it like this: | |
# app.entitlements = app.read_provisioning_profile_entitlements | |
module Motion | |
module Project | |
class Config | |
def read_provisioning_profile_entitlements | |
text = File.read(provisioning_profile) | |
text.force_encoding('binary') if RUBY_VERSION >= '1.9.0' | |
text = text.scan(/<key>\s*Entitlements\s*<\/key>\s*<dict>(.*?)\s*<\/dict>/m)[0][0] |
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
Original http://pkgs.fedoraproject.org/cgit/htmldoc.git/plain/htmldoc-1.8.27-libpng15.patch?h=f18 | |
From upstream 1.8 branch svn r1668 | |
The previous libpng-1.5 conversion patch here caused corrupt PNG output | |
on 64 bit. e.g. http://answerpot.com/showthread.php?3662601-PNG+Rendering+Problems | |
The upstream version (below) works well. | |
Index: htmldoc/image.cxx |
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
class YapModel | |
def self.database | |
Dispatch.once { @database = YapDatabase.alloc.initWithPath(App.documents_path + "/yap.db") } | |
@database | |
end | |
def self.dbconnection | |
Thread.current["yap_dbconnection"] ||= WeakRef.new(new_dbconnection) | |
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
BEGIN; | |
DROP TABLE IF EXISTS tmp_series_episodes; | |
-- a temp table containing each episode with its cooresponding series | |
CREATE TEMP TABLE tmp_series_episodes AS | |
SELECT series.id series_id, | |
series.title series_name, | |
series.added_at series_added_at, | |
episode.id episode_id, |
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
# [ UIViewController, UIView, etc. ]... | |
[ UIViewController ].each do |klass| | |
klass.class_eval do | |
def self.allocWithZone(zone) | |
super.tap do |x| | |
p " + alloc! #{x.inspect}" | |
end | |
end | |
alias_method 'old_dealloc', 'dealloc' |
OlderNewer