Skip to content

Instantly share code, notes, and snippets.

View freebsd_on_mbp.md

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
yamaya / NSHashTable+NSMapTable.md
Last active Feb 15, 2022
NSHashTableとNSMapTable
View NSHashTable+NSMapTable.md

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
mathisonian / index.md
Last active Sep 20, 2022
requiring npm modules in the browser console
View index.md

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

inspiration

@ganta
ganta / japanese-patch-for-emacs-24.3.patch
Created Mar 12, 2013
Emacs 24.3への日本語環境用のパッチです
View japanese-patch-for-emacs-24.3.patch
diff --git configure.ac configure.ac
index 62f53a3..850eaa4 100644
--- configure.ac
+++ configure.ac
@@ -1571,7 +1571,7 @@ if test "${HAVE_NS}" = yes; then
leimdir="\${ns_appresdir}/leim"
INSTALL_ARCH_INDEP_EXTRA=
fi
- 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
codeincontext / gist:3862543
Created Oct 10, 2012
Photo capture, manipulation, and upload in iOS6 Safari
View gist:3862543
<!DOCTYPE html>
<html>
<head>
<title>iOS6 Safari Photo Capture Demo</title>
<script type="text/javascript">
window.onload = function() {
var input = document.getElementById("input");
input.addEventListener("change", handleFile);
}
@henry0312
henry0312 / build_emacs24.2.sh
Created Aug 27, 2012
Build Emacs 24.2 on OS X 10.8.1
View build_emacs24.2.sh
#!/bin/sh
# 初期設定
EMACS_VER=24.2
WORK_DIR=$HOME/Builds/Emacs
BUILD_DIR=$WORK_DIR/build
PATCH_DIR=$WORK_DIR/patch
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export CC='/usr/bin/clang'
@steipete
steipete / GlobalHeader.h
Created Jul 11, 2012
Use subscripting with Xcode 4.4/iOS 4.3+
View GlobalHeader.h
// Add support for subscripting to the iOS 5 SDK.
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 60000
@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;
@end
@ryseto
ryseto / gist:2259918
Created Mar 31, 2012
Font setting for Emacs23 (Cocoa Emacs) create-fontset
View gist:2259918
;;; フォントセットを作る
(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)
@the-kenny
the-kenny / fullscreen-24.diff
Created Feb 5, 2012 — forked from bretthoerner/fullscreen-24.diff
Add ns-toggle-fullscreen to Emacs 24
View fullscreen-24.diff
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 157b2dd..f3807b7 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1263,6 +1263,11 @@ the operating system.")
(add-to-list 'window-system-initialization-alist '(ns . ns-initialize-window-system))
+(declare-function ns-toggle-fullscreen-internal "nsfns.m" ())
+(defun ns-toggle-fullscreen ()