Skip to content

Instantly share code, notes, and snippets.

Patch to cross compile to android with net/http support

Installation instructions

We need to patch Go's source code to allow cgo when cross-compiling and make Android-specific changes since it sometimes differs from linux (e.g.: it doesn't use /etc/resolv.conf for DNS config)

  1. Clone the go source: hg clone -u release https://code.google.com/p/go
  2. Enter the go source directory: cd go
  3. Apply the patch in this gist: patch -p1 < /path/to/patch/go_android.patch
  4. Enter the go/src directory: cd src
@nightire
nightire / Changes in Rails 4_1.md
Last active May 11, 2022 04:50
拥抱 Rails 4 —— 详述 Rails 4 的新变化

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
@davidwkeith
davidwkeith / index.html
Last active April 10, 2024 12:01
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom protocol handlers. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!--
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom
protocol handlers.
@kungfoo
kungfoo / 1.8.7-p358-with-rogue-stdout-patch
Created March 22, 2012 15:44
Installing 1.8.7-p358 with rbenv, when glibc >= 2.14 is installed
build_package_stdout_patch() {
wget 'http://bugs.ruby-lang.org/attachments/download/1931/stdout-rouge-fix.patch'
patch -p1 < stdout-rouge-fix.patch
}
require_gcc
install_package "ruby-1.8.7-p358" "http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p358.tar.gz" stdout_patch standard
install_package "rubygems-1.6.2" "http://production.cf.rubygems.org/rubygems/rubygems-1.6.2.tgz" ruby
@taxilian
taxilian / Factory.cpp
Created October 15, 2011 04:14
Example of adding a file-based logging method
#include <boost/filesystem.hpp>
#include "SystemHelpers.h"
using namespace boost::filesystem;
/// ...
void getLoggingMethods( FB::Log::LogMethodList& outMethods )
{
path appDataPath = FB::System::getLocalAppDataPath("CompanyName");
@mig
mig / init.el
Created January 18, 2011 21:00
Simple Emacs 24 configuration for Rails development
;; emacs configuration
(push "/usr/local/bin" exec-path)
(add-to-list 'load-path "~/.emacs.d")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)