Skip to content

Instantly share code, notes, and snippets.

@swayf
swayf / VBoxReloadKext.sh
Created November 4, 2012 00:17 — forked from rtgibbons/VBoxReloadKext.sh
Script: reload VirtualBox kernel extension in Mac OS X
#!/bin/bash
unload() {
kextstat | grep "org.virtualbox.kext.VBoxUSB" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxUSB
kextstat | grep "org.virtualbox.kext.VBoxNetFlt" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetFlt
kextstat | grep "org.virtualbox.kext.VBoxNetAdp" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxNetAdp
kextstat | grep "org.virtualbox.kext.VBoxDrv" > /dev/null 2>&1 && sudo kextunload -b org.virtualbox.kext.VBoxDrv
}
load() {
diff --git a/FilesystemLayouts/apple b/FilesystemLayouts/apple
index 9bd10e7..efefc31 100644
--- a/FilesystemLayouts/apple
+++ b/FilesystemLayouts/apple
@@ -31,11 +31,11 @@ GNUSTEP_MAKEFILES=/Library/GNUstep/Makefiles
GNUSTEP_SYSTEM_APPS=/Applications
GNUSTEP_SYSTEM_ADMIN_APPS=/Applications/Utilities
GNUSTEP_SYSTEM_WEB_APPS=/Library/WebApplications
-GNUSTEP_SYSTEM_TOOLS=/usr/local/bin
-GNUSTEP_SYSTEM_ADMIN_TOOLS=/usr/local/sbin
@swayf
swayf / Gen.hx
Last active August 29, 2015 14:06 — forked from back2dos/Gen.hx
package ;
import haxe.macro.*;
import haxe.macro.Type;
using haxe.macro.Tools;
private typedef Accessor = {
name: String,
read: Bool,
package ;
import neko.Lib;
import sys.db.Manager;
import sys.db.Object;
import sys.db.Sqlite;
import sys.db.Types.SDate;
import sys.db.Types.SId;
import sys.db.Types.SNull;
import sys.db.Types.SString;
package ;
import neko.Lib;
import sys.db.Manager;
import sys.db.Object;
import sys.db.Sqlite;
import sys.db.Types.SDate;
import sys.db.Types.SId;
import sys.db.Types.SNull;
import sys.db.Types.SString;
@swayf
swayf / Makefile
Last active August 29, 2015 14:07 — forked from mattmccray/Makefile
.PHONY: compile
time=/usr/bin/time
compile: dart typescript coffeescript haxe jsx
dart:
$(time) dart2js -ooutput/dart.js source/simple.dart
typescript:
@swayf
swayf / Main.hx
Last active August 29, 2015 14:08 — forked from nadako/Main.hx
import StructHelper.make;
typedef A = {
a:Int,
b:String,
c:Float,
d:Bool,
e:Array<Int>,
f:{
g:Array<Bool>,
@swayf
swayf / RegTest.hx
Last active August 29, 2015 14:11 — forked from Lerc/RegTest.hx
import js.html.Uint8Array;
@:build( RegisterMacro.memoryMappedRegister("r0",123) )
class RegTest
{
var ram : Uint8Array;
public function new() {
ram = new Uint8Array(65536);
}

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

package amd;
#if macro
import haxe.macro.Type;
import haxe.macro.Expr;
import haxe.macro.*;
import haxe.ds.*;
using Lambda;