Skip to content

Instantly share code, notes, and snippets.

mpasternacki /
Created January 23, 2015 17:12
FreeBSD on a MacBook Pro

FreeBSD on a MacBook Pro

Since 2008 or 2009 I work on Apple hardware and OS: back then I grew tired of Linux desktop (which is going to be MASSIVE NEXT YEAR, at least since 2001), and switched to something that Just Works. Six years later, it less and less Just Works, started turning into spyware and nagware, and doesn't need much less maintenance than Linux desktop — at least for my work, which is system administration and software development, probably it is better for the mythical End User person. Work needed to get software I need running is not less obscure than work I'd need to do on Linux or othe Unix-like system. I am finding myself turning away from GUI programs that I used to appreciate, and most of the time I use OSX to just run a terminal, Firefox, and Emacs. GUI that used to be nice and unintrusive, got annoying. Either I came full circle in the last 15 years of my computer usage, or the OSX experience degraded in last 5 years. Again, this is from a sysadmin/developer ki

yamaya /
Last active February 15, 2022 00:22

NSHashTable & NSMapTable - NSHipsterの超意訳。

[iphone] NSHashTableとNSMapTable

[2014-08-26 18:45]

NSSetは値を強参照でもつ。NSDictionaryは値は強参照で、キーはコピーされる。 開発者が弱参照の値を保持したいとか、NSCopyingに適合しないオブジェクトをキーにしたい場合はNSValue +valueWithNonretainedObject:を使う必要があった。

このようなケースにおいて、iOS 6(MacではOS X 10.5)以降だと、NSHashTableNSMapTableを使用できる。

mathisonian /
Last active March 22, 2023 05:31
requiring npm modules in the browser console

demo gif

The final result: require() any module on npm in your browser console with browserify

This article is written to explain how the above gif works in the chrome (and other) browser consoles. A quick disclaimer: this whole thing is a huge hack, it shouldn't be used for anything seriously, and there are probably much better ways of accomplishing the same.

Update: There are much better ways of accomplishing the same, and the script has been updated to use a much simpler method pulling directly from browserify-cdn. See this thread for details: mathisonian/requirify#5


ganta / japanese-patch-for-emacs-24.3.patch
Created March 12, 2013 00:13
Emacs 24.3への日本語環境用のパッチです
diff --git
index 62f53a3..850eaa4 100644
@@ -1571,7 +1571,7 @@ if test "${HAVE_NS}" = yes; then
- NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o"
+ NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o macim.o"
codeincontext / gist:3862543
Created October 10, 2012 01:11
Photo capture, manipulation, and upload in iOS6 Safari
<!DOCTYPE html>
<title>iOS6 Safari Photo Capture Demo</title>
<script type="text/javascript">
window.onload = function() {
var input = document.getElementById("input");
input.addEventListener("change", handleFile);
henry0312 /
Created August 27, 2012 10:07
Build Emacs 24.2 on OS X 10.8.1
# 初期設定
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export CC='/usr/bin/clang'
steipete / GlobalHeader.h
Created July 11, 2012 13:05
Use subscripting with Xcode 4.4/iOS 4.3+
// Add support for subscripting to the iOS 5 SDK.
@interface NSObject (PSPDFSubscriptingSupport)
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx;
- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key;
- (id)objectForKeyedSubscript:(id)key;
ryseto / gist:2259918
Created March 31, 2012 06:19
Font setting for Emacs23 (Cocoa Emacs) create-fontset
;;; フォントセットを作る
(let* ((fontset-name "myfonts") ; フォントセットの名前
(size 12) ; ASCIIフォントのサイズ [9/10/12/14/15/17/19/20/...]
(asciifont "Menlo") ; ASCIIフォント
(jpfont "Hiragino Maru Gothic ProN") ; 日本語フォント
(font (format "%s-%d:weight=normal:slant=normal" asciifont size))
(fontspec (font-spec :family asciifont))
(jp-fontspec (font-spec :family jpfont))
(fsn (create-fontset-from-ascii-font font nil fontset-name)))
(set-fontset-font fsn 'japanese-jisx0213.2004-1 jp-fontspec)
masutaka / init.el
Created December 16, 2011 17:45
(defface dired-todays-face '((t (:foreground "forest green"))) nil)
(defvar dired-todays-face 'dired-todays-face)
(defconst month-name-alist
'(("1" . "Jan") ("2" . "Feb") ("3" . "Mar") ("4" . "Apr")
("5" . "May") ("6" . "Jun") ("7" . "Jul") ("8" . "Aug")
("9" . "Sep") ("10" . "Oct") ("11" . "Nov") ("12" . "Dec")))
(defun dired-today-search (arg)
"Fontlock search function for dired."