This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$1" = "--stop" ] | |
then | |
git config --unset-all cowork.author | |
elif [ -n "$1" ] | |
then | |
author=$(git log --no-merges --author "$1" -1 --pretty="%an <%ae>") | |
if [ -n "$author" ] | |
then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
class RangeSet | |
include Enumerable | |
def initialize(ranges = []) | |
@ranges = merge(ranges) | |
end | |
def <<(range) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile without optimizations: | |
// cc -S -O0 -masm=intel const-expr.c | |
// Compile with optimizations: | |
// cc -S -O3 -masm=intel const-expr.c | |
int main() { | |
int x = 11; | |
int y = 12; | |
int z = x + y; | |
return z; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAX 100000000 | |
int calculate() { | |
int sum = 0; | |
for (int i = 0; i < 10; i++) { | |
sum += i; | |
} | |
return sum; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xcode-select --install | |
if [ ! -x /opt/homebrew/bin/brew ]; then | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
brew tap 'homebrew/bundle' | |
brew tap 'homebrew/services' | |
brew install automake clang-format cmake icu4c libressl libxml2 openssl pkg-config readline sqlite yajl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
const events = new Map(); | |
const stopped = new WeakMap(); | |
function before(subject, verb, fn) { | |
const source = subject[verb]; | |
subject[verb] = function() { | |
fn.apply(subject, arguments); | |
return source.apply(subject, arguments); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function createNode(text) { | |
var node = document.createElement('pre'); | |
node.style.width = '1px'; | |
node.style.height = '1px'; | |
node.style.position = 'fixed'; | |
node.style.top = '5px'; | |
node.textContent = text; | |
return node; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [ $# -ne 1 ]; then | |
echo "Usage: make-icns icon.png" | |
exit 1 | |
fi | |
IMAGE=$1 | |
OUT=`basename ${IMAGE%\.*}`.iconset | |
mkdir $OUT | |
sizes=(16 32 128 256 512) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function hashchange() { | |
if (!location.hash) { | |
return; | |
} | |
// Don't do anything if the current target exists. | |
if (document.querySelector(":target")) { | |
return; | |
} | |
var name = "user-content-" + decodeURIComponent(location.hash.slice(1)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
function status(response) { | |
if (response.ok) { | |
return response | |
} else { | |
var error = new Error(response.statusText || response.status) | |
error.response = response | |
throw error | |
} | |
} |
NewerOlder