Skip to content

Instantly share code, notes, and snippets.

//rootReducer.js
import { combineReducers} from 'redux';
//modules import
import app from './app';
import topics from './topics';
const combinedReducers = combineReducers({
[topics.constants.NAME] : topics.reducer,
@eLafo
eLafo / index.js
Last active October 25, 2016 16:15
//index.js
import React from 'react';
import ReactDOM from 'react-dom';
import {Provider} from 'react-redux';
import { createStore } from 'redux';
import AppContainer from './app/containers/AppContainer';
import todoApp from './rootReducer';
import injectTapEventPlugin from 'react-tap-event-plugin';
{
visibilityFilter: 'SHOW_ALL',
todos: [
{
text: 'Consider using Redux',
completed: true,
},
{
text: 'Keep all state in a single tree',
completed: false
@eLafo
eLafo / exceptions.rb
Created July 18, 2014 09:19
Concern exceptions
module Exceptions
extend ActiveSupport::Concern
included do
unless Rails.application.config.consider_all_requests_local
rescue_from Exception, with: :render_error
rescue_from ActiveRecord::RecordNotFound, with: :render_not_found
rescue_from ActionController::RoutingError, with: :render_not_found
rescue_from ActionController::UnknownController, with: :render_not_found
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
@eLafo
eLafo / chart.rb
Last active August 29, 2015 13:57
class Chart
def time_data_with_irregular_intervals(series, *args)
options = args.extract_options!
LazyHighCharts::HighChart.new('basic_line') do |f|
f.chart({ type: 'spline',
marginRight: 130,
marginBottom: 60 })
f.title({
text: options[:title],
def set_project_and_token_from_request request
@project_number = request.project_number
@token = request.token
@ga_data.merge_dimensions userID: @project_number
end
AEGON.Errors = {
call_center: function(path) {
call_center = $.get(path);
call_center.done(function(data, response) {
$.fancybox({
ajax: true,
content: data,
afterShow: function() {
AEGON.Errors.active_form();
class MainGraph
include ActiveModel::Validations
attr_reader :company, :starts_at, :ends_at
#attr_reader :graph_window_at, :period_search, :project_periods, :onthebench, :billable_by_period, :unbillable_by_period,
# :free_by_period, :billable, :unbillable, :free, :graph_form
validate :validate_graph
#def initialize(weeks_number, graph_form, company)
100.times{|i| puts i}
'this is a string'.reverse
[1,2,3,4,5].select{|x| x % 2 == 0}
user = User.new(name: 'Bruce', last_name: 'Dickinson')
# POST /clients
def create
@client = @company.clients.new(client_params)
if @client.save
redirect_to company_clients_url(@company)
else
render action: 'new'
end
end