Skip to content

Instantly share code, notes, and snippets.

🐧
¯\_(ツ)_/¯

Niels van Velzen nielsvanvelzen

🐧
¯\_(ツ)_/¯
Block or report user

Report or block nielsvanvelzen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nielsvanvelzen
nielsvanvelzen / main.lua
Last active Dec 12, 2015
LUA script for game engine.
View main.lua
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
View 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)
View picasa.js
/* 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];
View gameplay.list
tinkers-construct
storage-drawers
iron-chests
chisels-bits
rftools
random-things
actually-additions
psi
rftools-dimensions
more-foods
View example_database.js
'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,
View SampleScene.kt
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
View kotlin_touch_event.kt
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
View Tile.kt
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 Aug 13, 2017
Toggle prime on gnome
View prime-toggle.sh
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
ES6 Async constructors
View example.js
/*
* 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
You can’t perform that action at this time.