Skip to content

Instantly share code, notes, and snippets.

@payload
payload / issue22.js
Created April 23, 2011 16:08
repo.branch fails on empty repo
var git = require('nodegit');
git.repo().init("foo", true, function() {
git.repo("foo", function(err, repo) {
repo.branch("master", function(err, branch) {
console.log({
err: err,
branch: branch
});
console.log("doing something else");
});
@payload
payload / share.sh
Created January 26, 2012 23:46 — forked from astro/share.sh
Quick Sharing On The Local Chaos Bay
#!/bin/bash -e
URL=http://chaosbay.hq.c3d2.de
if [ -z "$1" ]; then
echo "Usage: $0 <file/dir>"
exit 2
fi
if [ -x "$(which mktorrent)" ]; then
@payload
payload / prettyics.sh
Created May 31, 2013 21:01
pretty print a .ics calendar file
#!/bin/sh
perl -ne'/END:/ && $i--; print "\t" x $i . "$_\n"; /BEGIN:/ && $i++;'
@payload
payload / palava-example.html
Last active January 1, 2016 01:38
A little example to get plava client library started.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Meine erste Videoapplikation</title>
<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="https://raw.github.com/Wolfy87/EventEmitter/master/EventEmitter.min.js"></script>
<script src="https://raw.github.com/palavatv/palava-client/master/palava.min.js"></script>
<script type="text/coffeescript">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from libavg import avg, app, player
class RemoteTestDiv(app.MainDiv):
def onInit(self):
self.canvas1 = player.createCanvas(id="1", size=(400,300))
self.canvas2 = player.createCanvas(id="2", size=(400,300))
@payload
payload / if_let_lint.rs
Last active August 29, 2015 14:10
rust compiler plugin to check for `if let` opportunities
#![feature(if_let)]
#[phase(plugin,link)]
extern crate syntax;
#[phase(plugin, link)]
extern crate rustc;
use syntax::ast::{Expr, ExprMatch, PatWild, PatWildSingle, ExprTup};
use rustc::lint::{Context, LintPass, LintArray};
use syntax::codemap::NO_EXPANSION;
@payload
payload / canvascapture.md
Created October 24, 2017 14:29 — forked from iandanforth/canvascapture.md
Capture WebGL frames to disk

How to capture WebGL/Canvas by piping data over a websocket.

This Gist builds on https://gist.github.com/unconed/4370822 from @unconed.

Instead of the original method which writes to the browsers sandboxed filesystem here we use a websocket connection provided by websocketd to pipe image data to a short python script that writes out the .png files to disk.

Install websocketd

@payload
payload / Camera.gd
Created August 8, 2019 18:59
simple godot camera control almost like in editor
extends Camera
export var speed = 5
export var max_speed = 20
export var wheel_speed = 5
export var fov_speed = 20
export var size_factor = 0.1
export var rotate_speed_x = 0.01
export var rotate_speed_y = 0.01
@payload
payload / Area2D.gd
Created January 3, 2020 12:16
Godot 3.2 - Area2D collides with TileMap cells
extends Area2D
func _ready():
connect("area_shape_entered", self, "area_shape_entered")
func area_shape_entered(area_id: int, area: Area2D, area_shape: int, self_shape: int):
var trans = Physics2DServer.area_get_shape_transform(area.get_rid(), area_shape)
var tilemap = area.get_node("Items") as TileMap
var offset = 2 * tilemap.cell_size if tilemap.centered_textures else Vector2.ZERO
var orig = trans.xform(offset)
@payload
payload / rotating_bevy.rs
Created August 23, 2021 21:18
rotating bevy
use bevy::prelude::*;
fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_startup_system(setup)
.add_system(update)
.run();
}