Skip to content

Instantly share code, notes, and snippets.

@funkatron
funkatron / vbox3to4.md
Created May 5, 2011 01:58
Moving a webOS VM from one OS X box to another

On my LAN, I have:

  • Machine A: An OS X machine running VirtualBox 3.2
  • Machine B: An OS X machine running VirtualBox 4

Here's what I did:

  1. first, create the image on machine A by running the Palm Emulator application.
  2. open VirtualBox 3.2 on machine A to make sure it set up correctly. Run it and watch it boot. If it works fine, shut it down.
  3. On Machine B, close all VBox VMs that are currently running, and close the VirtualBox application if it is running.

Remove me from this list and please don't contact me again by any means. That means don't e-mail me, don't call me, don't find me at conferences, don't send carrier pigeons to my house with small notes attached to their feet, don't even wave to me in the street if you see me. I'll snub you right there in public and that will be really awkward for you. I can't be held responsible if your friends don't talk to you anymore after that. And no, I don't care how great your position supposedly is, what technology it's using, where it's at, how many celebrities are invested, how close they are to closing funding, how much equity they're offering, how many times Paul Graham has high-fived the founders, how close they are to the Mission in San Francisco, how much the position is paying, how great the company is, who claims they know me that works there, how big their signing bonus is, or who I'll supposedly be working for/with. I'm not interested.

Just once more to be totally clear: don't contact me again. At al

@Integralist
Integralist / DependencyHelper.js
Last active February 3, 2018 04:55
Better Mocking using RequireJS' `undef` method to unset redefined modules
define(['require'], function(require) {
var stubbed = [];
return {
stub: function(name, implementation) {
stubbed.push(name);
requirejs.undef(name);
define(name, [], function() {
return implementation;
});
},
@ahoppen
ahoppen / Swift Incremental Syntax Parsing.md
Created May 3, 2018 15:40
Swift Incremental Syntax Parsing

Swift incremental syntax parsing

This proposal aims to add an incremental syntax parsing mode to the Swift compiler that takes a syntax tree of a pre-edit file, a post-edit file, and a diff between the pre-edit and the post-edit file as its input. It then generates the libSyntax tree of the modified file based on this information.

Motivation

In order to be able to use libSyntax for syntax colouring in IDEs, libSyntax needs to be able to rapidly regenerate the syntax tree based on minor edits. A complete reparse of the file is not acceptable. This proposal adds an incremental syntax parsing mode to the compiler that is able to rearrange on old syntax tree based on minor edits that have been performed on the source file.

The goal is that this incremental compilation is (nearly) in O(1) in terms of the size of the original source file so that the delay for regenerating syntax colouring after a single edit is independent of the file's size.

@modocache
modocache / gist:2ef5e3916b97b97a1aa9e0126208aea9
Created March 30, 2016 01:05
Attaching LLDB to a Debug build of Swift
$ lldb -- ../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc -dump-parse ~/GitHub/tmp/hello.swift
(lldb) target create "../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc"
Current executable set to '../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc' (x86_64).
(lldb) settings set -- target.run-args "-dump-parse" "/Users/bgesiak/GitHub/tmp/hello.swift"
(lldb) process launch --stop-at-entry
Process 91478 stopped
* thread #1: tid = 0x1bd329, 0x00007fff5fc01000 dyld`_dyld_start, stop reason = signal SIGSTOP
frame #0: 0x00007fff5fc01000 dyld`_dyld_start
dyld`_dyld_start:
-> 0x7fff5fc01000 <+0>: popq %rdi
@rnapier
rnapier / NSData.bytesView.swift
Last active January 30, 2019 00:40
Bytes collection for NSData
import Foundation
// Why bytesView rather than just extending NSData directly?
// Because this way we can keep our extension internal and not conflict
// with someone who imports us and has also extended NSData.
// If you're top-level code, you can just hoist everyting up to NSData directly.
internal extension NSData {
var bytesView: BytesView { return BytesView(self) }
}
@rlivsey
rlivsey / git-prune-tags.rb
Created March 26, 2010 15:47
Script to prune any tags which exist locally but not on the remote
#!/usr/bin/env ruby
require 'readline'
def prompt(prompt="> ")
input = nil
prompt += " " unless prompt =~ /\s$/
loop do
input = Readline.readline(prompt)
break if input.length > 0
end
@harlanhaskins
harlanhaskins / StringScanner.swift
Last active August 4, 2020 23:45
Swift String Scanner
import Foundation
/// `StringScanner` is a fast scanner for Strings and String-like objects.
/// It's used to extract structured bits from unstructured strings, while
/// avoiding making extra copies of string bits until absolutely necessary.
/// You can build Scanners over Substrings, allowing you to scan
/// parts of strings and use smaller, more specialized scanners to extract bits
/// of that String without needing to reuse another scanner.
public struct StringScanner<Input: StringProtocol> {
let input: Input
@JALsnipe
JALsnipe / crc32.swift
Created October 11, 2016 15:14 — forked from MaddTheSane/crc32.swift
crc32 implemented in Swift (Swift 3)
//
// crc32.swift
// SuperSFV
//
// Created by C.W. Betts on 8/23/15.
//
//
/* crc32.swift -- compute the CRC-32 of a data stream
Copyright (C) 1995-1998 Mark Adler
Copyright (C) 2015 C.W. "Madd the Sane" Betts
@jhermann
jhermann / git-commit-emojis.md
Last active September 23, 2023 07:09
Useful emoji for git commit messages

Useful emoji for git commit messages

If you add emoji to your commit messages for a GitHub repo, they become less boring, and you can convey the kind of change you're adding. See the full set of GitHub supported emoji here (also useful for easy copy&paste via a simple click).

Example commit message

The following is a possible scheme to use: