Skip to content

Instantly share code, notes, and snippets.

View jaybill's full-sized avatar

Jaybill McCarthy jaybill

View GitHub Profile
@jaybill
jaybill / header.h
Created January 25, 2021 18:15
Header for c2nim to add pragmas for dll
#ifdef C2NIM
# dynlib solouddll
# cdecl
# if defined(windows)
# define solouddll "soloud.dll"
# elif defined(macosx)
# define solouddll "libsoloud.dylib"
# else
# define solouddll "libsoloud.so"
# endif
// Place your key bindings in this file to overwrite the defaults
[
{
"key": "f12",
"command": "workbench.action.tasks.runTask",
"args": "build"
},
{
"key": "f11",
"command": "workbench.action.tasks.runTask",
@jaybill
jaybill / dosbox.conf
Last active October 17, 2018 00:52
DOS94
# This is the configuration file for DOSBox 0.74-2. (Please use the latest version of DOSBox)
# Lines starting with a # are comment lines and are ignored by DOSBox.
# They are used to (briefly) document the effect of each option.
[sdl]
# fullscreen: Start dosbox directly in fullscreen. (Press ALT-Enter to go back)
# fulldouble: Use double buffering in fullscreen. It can reduce screen flickering, but it can also result in a slow DOSBox.
# fullresolution: What resolution to use for fullscreen: original, desktop or fixed size (e.g. 1024x768).
# Using your monitor's native resolution (desktop) with aspect=true might give the best results.
# If you end up with small window on a large screen, try an output different from surface.
@jaybill
jaybill / copytree.go
Created June 5, 2012 17:46
How to copy a directory tree (preserving permissions) in Go.
package main
import "fmt"
import "os"
import "io"
import "io/ioutil"
import "log"
// Copies file source to destination dest.
func CopyFile(source string, dest string) (err error) {
pacman -Sy \
mingw32/mingw-w64-i686-SDL2 \
mingw32/mingw-w64-i686-SDL2_gfx \
mingw32/mingw-w64-i686-SDL2_image \
mingw32/mingw-w64-i686-SDL2_mixer \
mingw32/mingw-w64-i686-SDL2_net \
mingw32/mingw-w64-i686-SDL2_ttf \
mingw32/mingw-w64-i686-smpeg2 \
mingw64/mingw-w64-x86_64-SDL2 \
mingw64/mingw-w64-x86_64-SDL2_gfx \
@jaybill
jaybill / runprops.js
Last active March 15, 2017 06:43
Execute any property of an object that's a function.
var init = {
foo: function(){ console.log('foo') },
bar: function(){ console.log('bar') },
baz: 3.14
}
for (var key in init) {
if (!init.hasOwnProperty(key)) {
continue;
}
http://www.dynamsoft.com/download/TWAIN/twainds.win32.installer.2.1.3.msi
#git
alias _gc="git commit -a -m"
alias _gf="git pull"
alias _gp="git push"
alias _gpt="git push --tags"
alias _gs="git status"
alias _ga="git add"
/* See http://godoc.org/bitbucket.org/jaybill/sawsij/framework/model#DbSetup for how to set up a DbSetup object */
db := &model.DbSetup{}
....
post := &Post{Name: "Jimmy", Title: "First Post", Slug: "firstpost"}
t := &model.Table{Db: db}
err := t.Insert(post)
// assuming no error, post.Id will now contain the auto-inserted Id.
var f = "mailto:foo@bar";
if (f.substring(0,"mailto".length) == "mailto")
{
var email = f.substring( "mailto".length + 1, f.length);
console.log(email)
};