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 'formula' | |
class Tsocks < Formula | |
# The original is http://tsocks.sourceforge.net/ | |
# This GitHub repo is a maintained fork with OSX support | |
homepage 'http://github.com/pc/tsocks' | |
head 'https://github.com/pc/tsocks.git' | |
depends_on 'autoconf' => :build if MacOS.xcode_version.to_f >= 4.3 |
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
# Go to the project dir | |
prcd() { | |
project=$* | |
cd $PROJECTS_HOME/$project | |
} | |
# Create new project and cd in the project path and open ST | |
prnew() { | |
mkdir "$PROJECTS_HOME/$*" && cd "$PROJECTS_HOME/$*" && git init | |
} |
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
#include <stdlib.h> | |
#include <stdio.h> | |
/* Include the mruby headers */ | |
#include <mruby.h> | |
#include <mruby/proc.h> | |
#include <mruby/data.h> | |
#include <mruby/compile.h> | |
int main(int argc, const char * argv[]) |
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
# http://www.mono-project.com/Compiling_Mono_on_OSX | |
require 'formula' | |
class Mono < Formula | |
#url 'http://download.mono-project.com/sources/mono/mono-3.0.6.tar.bz2' | |
#sha1 'e2187f80366fcd65c55a1ab946f8d3b39e81be77' | |
url 'http://download.mono-project.com/sources/mono/mono-2.10.9.tar.bz2' | |
sha1 '1a6e8c5a0c3d88d87982259aa04402e028a283de' | |
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
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") | |
include(android.toolchain) | |
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
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 'socket' | |
require "http/parser" | |
READ_CHUNK = 1024 * 4 | |
socket = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM) | |
addr = Socket.pack_sockaddr_in(9799, '127.0.0.1') | |
socket.bind(addr) | |
socket.listen(Socket::SOMAXCONN) | |
socket.setsockopt(:SOCKET, :REUSEADDR, true) |
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
def true.if_true; yield end; | |
def false.if_true; end; | |
def true.if_false; end; | |
def false.if_false; yield end; | |
a = true |
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
[] | |
HELLO | |
hello | |
[{:upcase!=>"hello"}, {:downcase!=>"HELLO"}] | |
[Finished in 0.1s] |
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/sh | |
isFullyCharged=`ioreg -n AppleSmartBattery | grep FullyCharged | awk '{ print $5 }'` | |
timeLeft=`ioreg -n AppleSmartBattery | grep TimeRemaining | awk '{ print $5 }'` | |
isCharging=`ioreg -n AppleSmartBattery | grep IsCharging | awk '{ print $5 }'` | |
if [ $isFullyCharged = "Yes" ] ; then | |
output="Full Charge" | |
else | |
output="$timeLeft mins" | |
if [ $isCharging = "Yes" ] ; then |
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 Item < ActiveRecord::Base | |
has_many :places, conditions: Proc.new { "filter_status = #{@filter_status}"} | |
attr_accessor :filter_status | |
end |