Skip to content

Instantly share code, notes, and snippets.

View datatypevoid's full-sized avatar

Null Void datatypevoid

View GitHub Profile

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@datatypevoid
datatypevoid / deepcopy.lua
Created March 23, 2017 15:09 — forked from Deco/deepcopy.lua
Lua Non-recursive Deep-copy
--[[ deepcopy.lua
Deep-copy function for Lua - v0.2
==============================
- Does not overflow the stack.
- Maintains cyclic-references
- Copies metatables
- Maintains common upvalues between copied functions (for Lua 5.2 only)
TODO
@datatypevoid
datatypevoid / d_copy.lua
Created March 23, 2017 15:09 — forked from MihailJP/d_copy.lua
Shallow- and deep-copy of table in Lua
function clone (t) -- deep-copy a table
if type(t) ~= "table" then return t end
local meta = getmetatable(t)
local target = {}
for k, v in pairs(t) do
if type(v) == "table" then
target[k] = clone(v)
else
target[k] = v
end
@datatypevoid
datatypevoid / safe_reference.lua
Created January 23, 2017 21:51 — forked from eliasdaler/safe_reference.lua
Safe reference implementation. Lua part. See https://eliasdaler.github.io/game-object-references for details
Handles = {}
local memoizedFuncs = {}
-- metatable which does magic
local mt = {}
mt.__index = function(handle, key)
if not handle.isValid then
print(debug.traceback())
error("Error: handle is not valid!", 2)
end
@datatypevoid
datatypevoid / safe_reference.cpp
Created January 23, 2017 21:51 — forked from eliasdaler/safe_reference.cpp
Safe reference implementation. C++ part. See https://eliasdaler.github.io/game-object-references for details
#include <sol.hpp>
#include <string>
#include <iostream>
using EntityId = int;
class Entity {
public:
explicit Entity(EntityId id) :
name("John"), id(id)
@datatypevoid
datatypevoid / os_name.lua
Created January 7, 2017 14:42 — forked from soulik/os_name.lua
OS type and CPU architecture detection in Lua language
local function getOS()
local raw_os_name, raw_arch_name = '', ''
-- LuaJIT shortcut
if jit and jit.os and jit.arch then
raw_os_name = jit.os
raw_arch_name = jit.arch
else
-- is popen supported?
local popen_status, popen_result = pcall(io.popen, "")
@datatypevoid
datatypevoid / uninstall-razer-synapse.sh
Created November 29, 2016 13:45 — forked from timotgl/uninstall-razer-synapse.sh
How to fully uninstall Razer Synapse on OS X El Capitan without using Razer's official uninstall tool
# How to uninstall Razer Synapse ( http://www.razerzone.com/synapse/ )
# on OS X El Capitan without using Razer's official uninstall tool.
# Tested on OS X 10.11.5 in July 2016.
# Step 1: In your terminal: stop and remove launch agents
launchctl remove com.razer.rzupdater
launchctl remove com.razerzone.rzdeviceengine
sudo rm /Library/LaunchAgents/com.razer.rzupdater.plist
sudo rm /Library/LaunchAgents/com.razerzone.rzdeviceengine.plist
@datatypevoid
datatypevoid / npm-upgrade-bleeding.sh
Created November 21, 2016 11:15 — forked from othiym23/npm-upgrade-bleeding.sh
a safe way to upgrade all of your globally-installed npm packages
#!/bin/sh
set -e
set -x
for package in $(npm -g outdated --parseable --depth=0 | cut -d: -f3)
do
npm -g install "$package"
done
@datatypevoid
datatypevoid / tmux-cheatsheet.markdown
Created November 4, 2016 05:13 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@datatypevoid
datatypevoid / IonicCordovaNetwork.js
Created July 3, 2016 00:07 — forked from welcoMattic/IonicCordovaNetwork.js
Async navigator.connection.type service for Ionic Framework
var myApp = angular.module('myApp').service('CordovaNetwork', ['$ionicPlatform', '$q', function($ionicPlatform, $q) {
// Get Cordova's global Connection object or emulate a smilar one
var Connection = window.Connection || {
"CELL" : "cellular",
"CELL_2G" : "2g",
"CELL_3G" : "3g",
"CELL_4G" : "4g",
"ETHERNET" : "ethernet",
"NONE" : "none",
"UNKNOWN" : "unknown",