Skip to content

Instantly share code, notes, and snippets.

View nielsvanvelzen's full-sized avatar
🟣
¯\_(ツ)_/¯

Niels van Velzen nielsvanvelzen

🟣
¯\_(ツ)_/¯
View GitHub Profile
@nielsvanvelzen
nielsvanvelzen / main.lua
Last active December 12, 2015 18:36
LUA script for game engine.
local width = 1600
local height = 900
window.create(width, height, "LuaGame") -- width, height, title
canvas.init();
local ticks = 0
local x = 0
local y = 0
local xBackwards = false
@nielsvanvelzen
nielsvanvelzen / interface_test.lua
Created December 13, 2015 16:02
interface_test.lua
local width = 1600
local height = 900
-- Create window & show loading message
window.create(width, height, "Interface test")
canvas.init()
canvas.beginFrame(width, height, 1.0)
canvas.createFont("Open Sans", "test/font/OpenSans-Regular.ttf")
canvas.fontFace("Open Sans")
canvas.fontSize(24)
/* npm install request */
var user = null;
var album = null;
var authkey = null;
var downloadDir = './download/{user}-{album}/';
var args = process.argv.slice(2);
if(args.length >= 1 && args[0].substr(0, 4) === 'http'){
user = args[0].substr(args[0].indexOf('.com/') + 5).split('/')[0];
@nielsvanvelzen
nielsvanvelzen / gameplay.list
Last active June 21, 2016 19:44
mserv/mods.list
tinkers-construct
storage-drawers
iron-chests
chisels-bits
rftools
random-things
actually-additions
psi
rftools-dimensions
more-foods
'use strict';
const Database = require('../src/Database');
//let database = new Database(__dirname + '/example.db'); // Use file "example.db"
let database = new Database(null); // Use memory
database.define('user', {
id: {type: Number, index: true},
name: String,
package nl.ndat.yui.scene
import java.io.File
import javax.imageio.ImageIO
class SampleScene : Scene() {
val logo = ImageIO.read(File("logo.png"))!!
var x = 0
var y = 0
var xR = false
import org.w3c.dom.events.EventTarget
import org.w3c.dom.events.UIEvent
external abstract class TouchEvent : UIEvent {
open val touches: Array<Touch>
open val targetTouches: Array<Touch>
open val changedTouches: Array<Touch>
open val altKey: Boolean
open val metaKey: Boolean
open val ctlKey: Boolean
package nl.ndat.isometric.ui
import nl.ndat.isometric.Bootstrap
import nl.ndat.isometric.core.IView
import org.w3c.dom.CanvasRenderingContext2D
import org.w3c.dom.Path2D
class Tile : IView() {
val styleInside = "#8BB255"
val styleInsideHover = "#54b2a5"
@nielsvanvelzen
nielsvanvelzen / prime-toggle.sh
Last active August 13, 2017 10:16
Toggle prime on gnome
CURRENT_DRIVER=$(prime-select query)
NEW_DRIVER="intel"
if [ "$CURRENT_DRIVER" = "intel" ]; then
NEW_DRIVER="nvidia"
fi
pkexec prime-select "$NEW_DRIVER" > /dev/null
echo "Switched from $CURRENT_DRIVER to $NEW_DRIVER"
@nielsvanvelzen
nielsvanvelzen / example.js
Created May 3, 2018 19:41
ES6 Async constructors
/*
* Ecmascript supports the `async` keyword to make functions async.
* Unfortunately it doesn't work on construcors.
*
* However: you can return in a constructor!
*/
(async() => { // for top level await
class Example {
// ES6 constructor