Skip to content

Instantly share code, notes, and snippets.

Avatar

Rafal Pastuszak paprikka

View GitHub Profile
@paprikka
paprikka / Preferences.sublime-settings
Created Sep 27, 2013
A generic ST config for Mac & Windows. Don't forget to install Package Control and feed this baby with plugins!
View Preferences.sublime-settings
{
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
"*.tga",
"*.dds",
View let.js
"use strict"
var a = 'foo';
function foo() {
console.log(a);
var a = 'bar';
console.log(a);
};
@paprikka
paprikka / preloadGUI.cs
Created Dec 6, 2016
Poor man's prefabs
View preloadGUI.cs
public class GUIScreenLoader
{
private Transform container;
private MainNavGUIConfig config; // a ScriptableObject with a list of easily editable components
// it also contains a GUI Scene reference, for more control over
// resource loading.
public GUIScreenLoader(MainNavGUIConfig config, Transform container)
{
this.config = config;
View lana.sh
$ npm i -g lana-cli
# or
$ yarn global add lana-cli
@paprikka
paprikka / import.json
Created Apr 23, 2017
ES import with better autocomplete
View import.json
// Add this to your VSCode snippets
"import": {
"prefix": "imm",
"description": "ES module import",
"body": [
"import ${2:scope} from '${1:moduleName}'",
"${3}"
]
},
@paprikka
paprikka / sharedRouter.js
Created Oct 16, 2017
Shared router event subscriptions in Next.js
View sharedRouter.js
// usage:
// 1. import in your page/component/layout
// 2. subscribe in componentDidMount
// 3. make sure you unsubscribe in componentWillUnmount
import Router from 'next/router'
import { Observable } from 'rxjs'
console.log('route: initialising router')
export const routeChangeStart$ = Observable.create(
@paprikka
paprikka / createRequestHandler.ts
Created Dec 7, 2017
Handle Restify endpoints as Observables using RxJS
View createRequestHandler.ts
import { Observable, Subscription } from 'rxjs'
import {
Request,
Response,
Next
} from 'restify'
export interface RequestContext {
req: Request,
res: Response,
@paprikka
paprikka / route.js
Created Oct 27, 2018
Hapi route example
View route.js
import Joi from 'joi';
import Events from '../events';
const route = {
handler: ({params: {props}}, reply) => {
let parsedData;
try {
parsedData = JSON.parse(decodeURIComponent(props));
} catch (err) {
You can’t perform that action at this time.