Skip to content

Instantly share code, notes, and snippets.

View crisu83's full-sized avatar
🎩
Coding

Christoffer Niska crisu83

🎩
Coding
View GitHub Profile
@crisu83
crisu83 / example.js
Last active September 9, 2017 23:15
A work-in-progress implementation of Foundation Reveal for React-Foundation http://react.foundation
import React from 'react';
import { reveal, revealContext, revealOpen } from './reveal';
const Open = revealOpen({ name: 'example' })(
({ openReveal }) => (
<a onClick={() => openReveal({ a: 10 }}>Open me!</a>
)
);
const Modal = reveal({ name: 'example' })(
@crisu83
crisu83 / general-purpose-reducers.js
Last active June 6, 2017 17:59
General-purpose reducers for Redux.
/**
* This gist was inspired by the video course titled "Building React Applications with Idiomatic Redux"
* available on Egghead.io by the creator of Redux, Dan Abramov.
*
* The purpose of this gist is to demonstrate general purpose reducers that can be used via Redux's combineReducers
* to compose more complex reducers and therefore maximize code reuse.
*
* Feedback is more than welcome!
*
* @author Christoffer Niska <christofferniska@gmail.com>
@crisu83
crisu83 / auth-reducer.js
Created April 11, 2016 20:04
Authentication reducer for OAuth2.
/*eslint no-unused-vars: 0*/
import { fromJS, Map } from 'immutable';
import { createReducer } from '../helpers/store';
import { AuthActionTypes } from '../actions/auth';
import {
setSession,
setUser,
getSession,
getIsAuthenticated,
@crisu83
crisu83 / RenderGroup.js
Last active February 17, 2016 21:47
Custom Phaser Group that allows for sorting all of it's children recursively.
import { Group } from 'phaser';
/**
* Renders the given display objects using the given render session.
* @param {Array} displayObjects
* @param {Object} renderSession
*/
function renderDisplayObjects(displayObjects, renderSession) {
for (let i = 0; i < displayObjects.length; i++) {
displayObjects[i]._renderWebGL(renderSession);
@crisu83
crisu83 / resource-service.js
Last active November 16, 2015 09:25
Angular module that eases the pain of working with remote resources.
/**
* Module that eases the pain of working with remote resources.
*/
angular.module('nord.resource-service', [])
/**
* Constants for the default resource actions.
*/
.constant('ResourceAction', {
'CREATE': 'create',
'UPDATE': 'update',
@crisu83
crisu83 / _debug.scss
Created October 2, 2015 11:54
Angular debug component
.debug {
&__heading {
margin-bottom: 20px;
}
&__message {
background: $gray-lightest;
margin-bottom: 20px;
padding: 20px;
}
@crisu83
crisu83 / File.php
Last active August 29, 2015 14:24
WIP file manager module for Lumen framework
<?php namespace Nord\Lumen\FileManager;
use Jenssegers\Date\Date;
use Nord\Lumen\Doctrine\Traits\AutoIncrements;
class File
{
use AutoIncrements;
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Web server configuration
config.vm.define "web" do |web|
web.vm.box = "nordsoftware/nginx-php-nvm"
@crisu83
crisu83 / moment-locale-fi.js
Last active August 24, 2018 13:20
Finnish translation for Moment.js
//! moment.js locale configuration
//! locale : finnish (fi)
//! author : Tarmo Aidantausta : https://github.com/bleadof
//! author : Christoffer Niska : https://github.com/crisu83
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../moment')) :
typeof define === 'function' && define.amd ? define(['moment'], factory) :
factory(global.moment)
}(this, function (moment) { 'use strict';
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
<entity name="App\Entities\User" table="users">
<id name="surrogateId" type="integer" column="id">
<generator strategy="AUTO" />
</id>
<field name="id" type="string" column="identity" />