Skip to content

Instantly share code, notes, and snippets.

View nathan's full-sized avatar

Nathan nathan

View GitHub Profile
@natecook1000
natecook1000 / openRanges.swift
Last active May 27, 2021 19:37
Open-ended range operators for Swift
// Open-ended range operators
//
// 100... is equivalent to 100...Int.max
// ...-100 is equivalent to Int.min...-100
// ..<3 is equivalent to Int.min..<3
import Swift
/// Conforming types provide static `max` and `min` constants.
protocol MinMaxType {
@Noitidart
Noitidart / _template-BootstrapJSM.xpi
Last active July 22, 2018 03:30
ff-addon-template: Template for how to create a JSM module.
$ cat test.js
function foo () { while (true) { } }
function bar () { return foo(); }
bar();
$ node test.js &
$ gdb attach $(pidof node)
0x00000bf778c63d5f in ?? ()
(gdb) b v8::internal::Runtime_StackGuard
Breakpoint 1 at 0x84a1f0
(gdb) print 'v8::V8::TerminateExecution'(0)
@erisdev
erisdev / Poser.m
Created March 11, 2012 04:09
Miss +[NSObject poseAsClass:]? Don't use this, you might hurt yourself or someone you love.
#import <objc/runtime.h>
#import <stdlib.h>
// declare some of the Objective-C runtime's private parts where we can see them
typedef struct _NXMapTable NXMapTable;
extern NXMapTable *gdb_objc_realized_classes;
extern void *NXMapInsert(NXMapTable *table, const void *key, const void *value);
@implementation NSObject (Poser)