Skip to content

Instantly share code, notes, and snippets.

View valscion's full-sized avatar
🧸
On parental leave

Vesa Laakso valscion

🧸
On parental leave
View GitHub Profile
@valscion
valscion / netmatch-server.js
Created December 6, 2011 10:34
NetMatch server
var dgram = require('dgram'),
http = require('http'),
Buffer = require('buffer').Buffer,
util = require('util');
function Player () {
this.id = "";
this.active = false;
this.loggedIn = false;
this.name = "";
@valscion
valscion / main.cb
Created January 4, 2012 20:48
Til2JSON
'This is your first CoolBasic program!
Include "Resource.cb"
mapName$ = "Mictlan"
Global gMapCRC
map = LoadResourceMap(mapName)
If Not IsDirectory("converted") Then MakeDir "converted"
@valscion
valscion / raycast_testi.CB
Created January 9, 2012 19:35
CB raycast collision
ChDir "C:\Program Files (x86)\CoolBasic"
// CBRAYCASTER
// -----------
// Esimerkin näppäimet:
// - Enter: Vaihtaa debug-tilaa
// - Välilyönti: Generoi kartan uudelleen
// - Hiiren rulla: Muuttaa kartan satunnaisuuden astetta
// - WASD: Liikuttaa objektia
// - Nuolet vasen-oikea: Kääntää objektia
@valscion
valscion / media.json
Created March 7, 2012 07:56
Sergei - media-JSON
{
"skenet": {
"verstas": {
// "kuva"-listan kuvat haetaan automaattisesti kansiosta media/skenet/verstas,
// eli "ulkokuva.png" on oikeasti media/skenet/verstas/ulkokuva.png
"kuva": ["ulkokuva.png", "verstas.png"],
"info": "Tämä on autotalli"
},
"takapiha": {
@valscion
valscion / example_event.json
Created March 1, 2014 15:38
Example data for new Ilmomasiina
{
"event": {
"id": 1,
"name": "Sukulaissitsit",
"description": "Tervetuloa sukulaissitseille! ...",
"image": "http://www.example.com/lolwut.jpg", // Optional
"event_date": {
"date": "2014-02-28",
"time": "17:00+0300" // Optional
},
@valscion
valscion / mysql2sqlite.sh
Created May 5, 2014 14:04
mysql2sqlite.sh improved
#!/usr/bin/env bash
#
# mysql2sqlite.sh
# vqv
#
# A kludge for converting the MYSQL dump provided by http://www.baseball-databank.org/
# into a SQLITE3 compatible dump
#
# EXAMPLE USAGE: ./mysql2sqlite.sh BDB-sql-2008-03-28.sql | sqlite3 baseball.db
#
@valscion
valscion / MyComponent.jsx
Last active August 29, 2015 14:24
An example of redux reducer returning a function in the state
import { connect } from 'redux/react';
import { ActionTypes } from 'constants/myConstants';
const { CHANGE_STATUS } = ActionTypes;
@connect(reduxState => ({
// Query for specific action
statusIsLoading: reduxState.loading.isLoading(ActionTypes.CHANGE_STATUS),
// Query for any action
isLoading: reduxState.loading.isLoading()
@valscion
valscion / I18nRuntimePlugin.js
Created February 21, 2016 11:33
Venuu I18n Webpack integration
var ConstDependency = require('webpack/lib/dependencies/ConstDependency');
var NullFactory = require('webpack/lib/NullFactory');
var _ = require('lodash');
function I18nRuntimePlugin(options) {
options = options || {};
this.functionNames = options.functionNames || ['I18n.t', 'I18n.translate'];
this.translationsPlaceholder = options.translationsPlaceholder || 'I18N_RUNTIME_TRANSLATIONS';
this.fullTranslations = options.fullTranslations || {};
}
$ npm install -g [email protected]
-
> [email protected] install /Users/vesa/.nvm/versions/node/v4.4.0/lib/node_modules/flow-typed/node_modules/nodegit
> node lifecycleScripts/install
[nodegit] Fetching binary from S3.
[nodegit] Failed to install prebuilt binary:
{ [Error: Command failed: /bin/sh -c "/Users/vesa/.nvm/versions/node/v4.4.0/lib/node_modules/flow-typed/node_modules/nodegit/node_modules/.bin/node-pre-gyp" install --fallback-to-build=false
module.js:327
throw err;
@valscion
valscion / Datepicker_fun.user.js
Created November 15, 2016 11:45
Inject date to staff CSV page
// ==UserScript==
// @name Datepicker for Venuu CSV exports
// @include https://staging.venuu.fi/staff/csv_exports*
// @include https://venuu.fi/staff/csv_exports*
// @require https://code.jquery.com/ui/1.12.1/jquery-ui.min.js
// @grant none
// ==/UserScript==
//--- Date picker needs additional CSS
document.addEventListener('DOMContentLoaded', function () {
// Add jQuery UI CSS to page