Skip to content

Instantly share code, notes, and snippets.

View oderwat's full-sized avatar
💭
Gleam around...

Hans Raaf oderwat

💭
Gleam around...
View GitHub Profile
@oderwat
oderwat / Phone Words II.swift
Last active November 6, 2016 16:55 — forked from erica/Phone Words II.swift
Phone Words II for Swift 3.0.1
import Cocoa
// Missing isWord
func isWord(string: String) -> Bool {
if let _ = Int(string) { return false }
let range = NSSpellChecker.shared().checkSpelling(of: string, startingAt: 0)
return range.location == NSNotFound
}
/*:
@oderwat
oderwat / github-markdown.css
Created July 14, 2016 20:26
GitHub Style formatted markdown in VSCode
body { background-color: white; }
@font-face {
font-family: octicons-link;
src: url(data:font/woff;charset=utf-8;base64,d09GRgABAAAAAAZwABAAAAAACFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEU0lHAAAGaAAAAAgAAAAIAAAAAUdTVUIAAAZcAAAACgAAAAoAAQAAT1MvMgAAAyQAAABJAAAAYFYEU3RjbWFwAAADcAAAAEUAAACAAJThvmN2dCAAAATkAAAABAAAAAQAAAAAZnBnbQAAA7gAAACyAAABCUM+8IhnYXNwAAAGTAAAABAAAAAQABoAI2dseWYAAAFsAAABPAAAAZwcEq9taGVhZAAAAsgAAAA0AAAANgh4a91oaGVhAAADCAAAABoAAAAkCA8DRGhtdHgAAAL8AAAADAAAAAwGAACfbG9jYQAAAsAAAAAIAAAACABiATBtYXhwAAACqAAAABgAAAAgAA8ASm5hbWUAAAToAAABQgAAAlXu73sOcG9zdAAABiwAAAAeAAAAME3QpOBwcmVwAAAEbAAAAHYAAAB/aFGpk3jaTY6xa8JAGMW/O62BDi0tJLYQincXEypYIiGJjSgHniQ6umTsUEyLm5BV6NDBP8Tpts6F0v+k/0an2i+itHDw3v2+9+DBKTzsJNnWJNTgHEy4BgG3EMI9DCEDOGEXzDADU5hBKMIgNPZqoD3SilVaXZCER3/I7AtxEJLtzzuZfI+VVkprxTlXShWKb3TBecG11rwoNlmmn1P2WYcJczl32etSpKnziC7lQyWe1smVPy/Lt7Kc+0vWY/gAgIIEqAN9we0pwKXreiMasxvabDQMM4riO+qxM2ogwDGOZTXxwxDiycQIcoYFBLj5K3EIaSctAq2kTYiw+ymhce7vwM9jSqO8JyVd5RH9gyTt2+J/yUmYlIR0s04n6+7Vm1ozezUeLEaUjhaDSuXHwVRgvLJn1tQ7xiu
@oderwat
oderwat / Checkbox Demo
Created July 1, 2016 09:15
Checkbox Demo
To Do List:
* [x] Feature A
* [ ] Feature B
* [x] Feature C
* [ ] Feature D
@oderwat
oderwat / vsc-runner
Last active July 14, 2016 20:16
Little helper script for using Nim with "runner" extension in Visual Studio Code
#!/bin/bash
if [ -z "$1" ]; then
echo "No file given! You may need to save first!"
exit 5
fi
cd `dirname "$1"`
CMD="c --verbosity:0 --hints:off --parallelBuild:1 "
FULL="`basename "$1"`"
@oderwat
oderwat / strAccessObj.nim
Last active March 16, 2020 15:06
Access Objects in Nim by strings for fields (wrapper automatisation)
import macros
type Foo = object
a: int
b: int
c: float
#[
dumpTree:
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
@oderwat
oderwat / aporia-hacked-to-osx.md
Created March 22, 2015 01:07
Hacking Aporia (Nim IDE) to work on Yosemite OS X with GTK 2 Quartz (no X11)

Aporia on OS X Yosemite (GTK+ 2.x)

"Don't try at home or don't blame me for lost hours of your life!"

See this Nim Forum Topic where this started.

Well I have a working Aporia version on my Yosemite OS X 10.10.2 from the new-suggest branch of the repository.

BUT the lengths I had to go to get this working are plastered with stuff I did not understand :)

@oderwat
oderwat / nimrun
Created March 4, 2015 22:34
nimrun (using my modified tcc with nim on osx)
#!/bin/bash
rm nim/nimcache/*
nim c -c --verbosity:0 -w:off --hints:off nim/ex1.nim
./tcc nim/nimstub.c -I/usr/local/lib/nim nim/nimcache/*.c -run
@oderwat
oderwat / update-all-nim-gtk3.sh
Created February 24, 2015 21:18
Simple script to clone / pull and install the Nim GTK+3 wrappers from Stefan Saleski
#!/bin/bash
if [ ! -d "nim-gtk3" ]; then
git clone [email protected]:StefanSalewski/nim-gtk3.git
fi
cd nim-gtk3 && git pull && nimble install -y && cd ..
if [ ! -d "nim-gdk3" ]; then
git clone [email protected]:StefanSalewski/nim-gdk3.git
fi
@oderwat
oderwat / re_check_prime.nim
Last active August 29, 2015 14:15
Test for being prime with a regular expression in Nim (aka Nimrod)
# regular expression to check a number for being prime
#
# see: http://www.noulakaz.net/weblog/2007/03/18/a-regular-expression-to-check-for-prime-numbers/
import re, strutils
let rprime = re"^1?$|^(11+?)\1+$"
proc testPrime(n: int): bool =
not (repeatChar(n, '1') =~ rprime)