Skip to content

Instantly share code, notes, and snippets.

View ishikawa's full-sized avatar
🏠
Working from home

Takanori Ishikawa ishikawa

🏠
Working from home
View GitHub Profile
@ishikawa
ishikawa / objcfmt.py
Created March 13, 2010 11:28
The code formatter for Objective-C source programs.
#!/usr/bin/env python
# vim: set filetype=python :
"""
Synopsis
================================
*objcfmt* is the code formatter for Objective-C source programs.
@ishikawa
ishikawa / itunes.sh
Created April 4, 2010 09:04
itunes.sh - control your iTunes from shell
#/bin/bash
#
# itunes.sh - Control Your iTunes from shell
#
TRACK_PROGRAM=`cat <<EOS
tell current track
name & " - " & artist
end tell
EOS`
@ishikawa
ishikawa / colorize.py
Created August 18, 2010 14:48
"colorize" - The tiny module which provides ANSI color formatting
"""
This tiny module provides ANSI color formatting.
ANSI escape code - Wikipedia, the free encyclopedia
http://en.wikipedia.org/wiki/ANSI_escape_code
>>> colorize("")
''
>>> colorize("black and white")
'black and white'
@ishikawa
ishikawa / iterate_recursively.py
Created August 28, 2010 03:19
iterate_recursively: flatten a list easily
def iterate_recursively(*objects):
"""
Makes an iterator that returns elements from the `objects` argument.
If an element is a list or tuple, the element will be iterated
recursively, and the iterator returns each items.
>>> list(iterate_recursively(1, 2, 3))
[1, 2, 3]
>>> list(iterate_recursively([1, 2, 3]))
[1, 2, 3]
@ishikawa
ishikawa / runtests.py
Created August 31, 2010 16:36
runtests.py: (unit|doc)test discovery
#!/usr/bin/env python
"""
The **runtests.py** script supports simple test discovery (both `doctest`_ and `unittest`_)
and running discovered tests.
* ``-s DIRECTORY`` Directory to start discovery ('.' default)
* ``-t DIRECTORY`` Top level directory of project (default to start directory)
How to use::
@ishikawa
ishikawa / lisp.rb
Created October 30, 2010 17:35
The LISP expressed with Ruby
# lisp.rb - The LISP expressed with Ruby
#
# * Program code can be written in Ruby's data structures (Array, Symbol, ...)
# * LISP-2 (http://en.wikipedia.org/wiki/Lisp-1_vs._Lisp-2#The_function_namespace)
#
# "THE ROOTS OF LISP" by Paul Graham
# http://www.paulgraham.com/rootsoflisp.html
#
require 'strscan'
@ishikawa
ishikawa / llvm-core-h.diff
Created December 5, 2010 03:59
llvm-2.7 -> llvm-2.8: include/llvm-c/Core.h
--- include/llvm-c/Core.h 2010-03-04 08:51:25.000000000 +0900
+++ ../llvm-2.8/include/llvm-c/Core.h 2010-08-28 13:09:24.000000000 +0900
@@ -204,8 +204,7 @@
LLVMPointerTypeKind, /**< Pointers */
LLVMOpaqueTypeKind, /**< Opaque: type with unknown structure */
LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
- LLVMMetadataTypeKind, /**< Metadata */
- LLVMUnionTypeKind /**< Unions */
+ LLVMMetadataTypeKind /**< Metadata */
} LLVMTypeKind;
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@radianttap
radianttap / gist:4455176
Last active August 16, 2018 08:52
Inserting child controllers in the Auto-Layout world.
// ## inserting. this can be done in viewDidLoad
// this can be any view, here I'm adding to main view
UIView *containerView = self.view;
// load child controller
UIViewController *svc = [[UIViewController alloc] initWithNibName:nil bundle:nil];
// kill the randomness
svc.view.translatesAutoresizingMaskIntoConstraints = NO;
// add child VC to hierarchy
[self addChildViewController:svc];
// set initial rect
@foozmeat
foozmeat / openssl-build.sh
Last active December 12, 2023 19:41
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh