Skip to content

Instantly share code, notes, and snippets.

View XeeD's full-sized avatar

Lukáš Voda XeeD

View GitHub Profile
@XeeD
XeeD / load_user_state.js
Created June 2, 2015 23:07
Este user state for multiple promises
import Promise from 'bluebird'
import config from '../config'
export default function loadUserState(req, res, next) {
const dataSources = [loadMessages(), loadSomeOtherData()]
if (config.translationServer.loadTranslations)
dataSources.push(loadTranslations())
Promise.settle(dataSources).then(receivedData => {
@XeeD
XeeD / README.md
Last active September 1, 2016 15:54
Este.js and react-transmit

Data fetching for Este with react-transmit

1) Without server rendering

Read the DOCS.

This is easy and straightforward. All you need is to add react-transmit into dependencies (npm install --save react-transmit). Transmit works as a Higher-order component so instead of

export default class Dashboard extends PureComponent {
 // ...
@XeeD
XeeD / JavaScript.md
Last active March 9, 2016 06:07
JavaScript stack resources
@XeeD
XeeD / .rubocop.yml
Created January 28, 2015 10:04
Rubocop config
AllCops:
Exclude:
- db/schema.rb
- bin/*
RunRailsCops: true
AbcSize:
Enabled: false
AccessorMethodName:
@XeeD
XeeD / subclass.rb
Last active August 29, 2015 14:13
MobilePhoneLengthValidator
class MobilePhoneLengthValidator < ActiveModel::Validations::LengthValidator
def initialize(*)
super
@options = options.dup
end
def validate_each(*)
options.merge!(configured_validations)
super
@XeeD
XeeD / BirthNumberValidator.java
Created November 24, 2014 07:53
BirthNumberValidator.java
//Copyright (c) 2013, Petr Prokop
//All rights reserved.
//
//Redistribution and use in source and binary forms, with or without
//modification, are permitted provided that the following conditions are met:
//
//1. Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//2. Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
@XeeD
XeeD / .gitconfig
Last active February 9, 2018 14:19
[color]
ui = auto
[core]
editor = vim
autocrlf = false
whitespace = space-before-tab,cr-at-eol
excludesfile = ~/.gitignore_global
trustctime = false
mergeoptions = --no-edit
[alias]
AASM::Event.class_eval do
def fire_callbacks_with_logging(*args, &block)
fire_callbacks_without_logging(*args, &block)
end
alias_method_chain :fire_callbacks, :logging
end