Skip to content

Instantly share code, notes, and snippets.

View morgondag's full-sized avatar
😎
(◉-◉)

Kim Aarnseth morgondag

😎
(◉-◉)
View GitHub Profile
5013ca5c4ca81ef0ef06b6cb8e67b84c
Key alias: QG1vcmdvbmRhZy9nZXRnZWVr
Key password: 80766cfee31f0e620e0a9f52800bac85
@morgondag
morgondag / main.cpp
Created February 24, 2018 18:49
vulkan 101
#include <SDL2/SDL.h>
#include <SDL_vulkan.h>
#include <vulkan/vulkan.h>
#include <stdio.h>
#include <chrono>
#include <iostream>
#include <thread>
#include <vector>
@morgondag
morgondag / router.jsx
Created September 13, 2016 19:43
basic auth example
import React, { Component } from 'react'
import { render } from 'react-dom'
import { browserHistory, Router, Route, Link, withRouter } from 'react-router'
import { checkAuth } from './utils/auth.jsx'
import App from './components/app.jsx'
import Dashboard from './components/dashboard.jsx'
import Register from './components/register.jsx'
import Forgot from './components/forgot.jsx'
{
"bold_folder_labels": true,
"caret_style": "phase",
"color_scheme": "Packages/Theme - Spacegray/base16-eighties.dark.tmTheme",
"detect_indentation": true,
"draw_minimap_border": true,
"draw_white_space": "selection",
"ensure_newline_at_eof_on_save": true,
"fade_fold_buttons": false,
"folder_exclude_patterns":
@morgondag
morgondag / gist:896c76f69888afc1236c
Created September 10, 2015 07:15
nw.js settings per platform
Windows:
"chromium-args": "--in-process-gpu --ignore-gpu-blacklist --enable-webgl --disable-transparency --disable-device-orientation"
Linux:
"chromium-args": "--ignore-gpu-blacklist --enable-webgl --disable-transparency --disable-device-orientation --disable-setuid-sandbox"
Mac OS X:
"chromium-args": "--ignore-gpu-blacklist --enable-webgl --disable-transparency --disable-device-orientation"
@morgondag
morgondag / gulpfile.js
Created September 1, 2015 14:11
render
var render = require('./app/render.js');
// Build our templates
gulp.task('templates', function() {
render.render(templateData.JS, templateData.CSS);
})
for (var i = 0; i < 6; i++) {
x = basepos.x + Math.sin( (Math.PI/12*i))*(600);
y = basepos.y + Math.cos( (Math.PI/12*i))*(600);
this.deployStar(x,y);
}
encode4HTML:function(str) {
return str
//.replace(/\r\n?/g,'\n')
// normalize newlines - I'm not sure how these
// are parsed in PC's. In Mac's they're \n's
//.replace(/(^((?!\n)\s)+|((?!\n)\s)+$)/gm,'')
// trim each line
//.replace(/(?!\n)\s+/g,' ')
// reduce multiple spaces to 2 (like in "a b")
//.replace(/^\n+|\n+$/g,'')
@morgondag
morgondag / linky
Created September 26, 2014 11:37
Linkify
linkify: function(inputText) {
var replacedText, replacePattern1, replacePattern2, replacePattern3;
replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim;
replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');
replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');
replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim;
replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');
replacedText = replacedText.replace(/\B@([\w-]+)/gm, '<a href="http://twitter.com/$1" target="_blank">@$1</a>');
return replacedText;
@morgondag
morgondag / node-proxy
Created June 23, 2014 09:27
basic proxy
var httpProxy = require('http-proxy');
var proxy = httpProxy.createProxyServer();
var http = require('http')
http.createServer(function(req, res) {
proxy.web(req, res, { target: 'http://127.0.0.1/'});
}).listen(8787);