Skip to content

Instantly share code, notes, and snippets.

View DreadKnight's full-sized avatar
🦇
Working on Ancient Beast v0.5, woot!

Dread Knight DreadKnight

🦇
Working on Ancient Beast v0.5, woot!
View GitHub Profile
@incompl
incompl / game.js
Last active December 10, 2015 11:39
Code for my Box2d screencast on Bocoup.com
var canvasElem = document.getElementById("game");
var world = boxbox.createWorld(canvasElem);
world.createEntity({
name: "player",
shape: "circle",
radius: 1,
image: "pig.png",
imageStretchToFit: true,
density: 4,
@taldanzig
taldanzig / gitpushpull.md
Created January 23, 2013 06:38
Make push/pull work with a remote non-bare repository

Make push/pull work with a remote non-bare repository

Sometimes it is necessary (and desireable) to work on a git repository on multiple development machines. We want to be able to push and pull between repositories without having to use an intermediary bare repository, and for this to work symetrically in both repositories.

First clone we clone an existing repository:

git clone ssh://user@hostname:/path/to/repo

By default this will name the remote as origin, but let's assume we want to reserve that name for a master repository that commits will eventually get pushed to:

@kvnsmth
kvnsmth / example-subtree-usage.md
Last active March 5, 2023 21:58
A real world usage for git subtrees.

Let's say you have an iOS project, and you want to use some external library, like AFNetworking. How do you integrate it?

With submodules

Add the project to your repo:

git submodule add git@github.com:AFNetworking/AFNetworking.git Vendor/AFNetworking

or something to that effect.

@jamesflorentino
jamesflorentino / convert.sh
Last active September 20, 2016 10:54
Makefile for creating favicons from 16x16 up to 128x128.
convert favicon.png -resize 16x16 favicon.ico;
convert favicon.png -resize 16x16 favicon_16x16.png;
convert favicon.png -resize 32x32 favicon_32x32.png;
convert favicon.png -resize 64x64 favicon_64x64.png;
convert favicon.png -resize 128x128 favicon_128x128.png;
echo "conversion complete";
@gr2m
gr2m / account_dreamcode.js
Last active May 7, 2022 08:22
Imagine the typical backend tasks for user authentication would exist right in the browser. How would the code look like? This is what I came up with. Forks & comments much appreciated! #nobackend #dreamcode
// sign up
account.signUp('joe@example.com', 'secret');
// sign in
account.signIn('joe@example.com', 'secret');
// sign in via oauth
account.signInWith('twitter');
// sign out
@willurd
willurd / web-servers.md
Last active May 4, 2024 07:22
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@twolfson
twolfson / .gitignore
Last active September 17, 2021 08:23
Scrape all GitHub watchers, stargazers, and followers
node_modules/
fixtures/
output/
config.json
@luser
luser / gamepad-buttons.js
Created December 6, 2013 20:45
Gamepad API button handling
function listButtons(gamepad) {
for (var i = 0; i < gamepad.buttons.length; i++) {
var b = gamepad.buttons[i];
var pressed, val;
if (typeof(b) == "object") {
pressed = b.pressed;
val = b.value;
} else {
val = b;
pressed = b == 1.0;
@gitaarik
gitaarik / git_submodules.md
Last active May 4, 2024 11:10
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of usecases of submodules:

  • Separate big codebases into multiple repositories.
@korya
korya / Subfolder to git repo.md
Last active December 16, 2023 10:29
Convert subfolder into Git submodule