Skip to content

Instantly share code, notes, and snippets.

View hiasinho's full-sized avatar

Mathias Maisberger hiasinho

View GitHub Profile
Ctrl+A
module FactoryGirlHelper
def find_or_create(*args)
name = args.shift
clazz = nil
# convert from underscores String to camelcase Class
if name.is_a? Hash
name = name.first[0]
clazz = name.first[1].to_s.camelize.constantize
@hiasinho
hiasinho / backbone.react.coffee
Last active August 29, 2015 14:14
React mixin for integrating Backbone
Backbone.React = {} unless Backbone.React
Backbone.React.Base = {} unless Backbone.React.Base
###
Backbone React Base Mixin
=========================
Usage example:
--------------
@hiasinho
hiasinho / regex_dec_w_unit.rb
Created January 9, 2012 15:50
Regex for decimal with unit
matchdata = "121,32 Std.".match(/([\d]+[\,|\.]?\d{0,2})+\s?(\w.*)?/)
matchdata[1] # => "121,32"
matchdata[2] # => "Std."
matchdata[0] # => "121,32 Std."
var hello = "Hello Hias!";
console.log(hello);
@hiasinho
hiasinho / Todos.js
Last active June 3, 2016 06:06
Reducer Adapters
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import TodoActions as actions from '../actions';
import TodoList from '../components/TodoList';
// This is for POJO
import { query } from '../utils/helpersPojo'
// Uncomment this is for Immutable.js
@hiasinho
hiasinho / vim-cheatsheet.md
Last active November 19, 2016 13:16
VIM Cheatsheet

VIM Cheat Sheet

Cursor movement

Key Description
h move cursor left
j move cursor down
@hiasinho
hiasinho / instructions.md
Last active January 26, 2017 13:48
DigitalOcean, Dokku, Rails, PostgreSQL
#! /bin/bash
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
FILE_TYPES="\.(erb|html|haml|rb|js|jsx|cjsx)"
CLASSES_PREFIX="class(Name)?=[\"\'](.*\s)?"
SELECTORS=(
@hiasinho
hiasinho / foundation-grid.scss
Last active March 31, 2017 06:41
Extend inuit.css
// Foundation Grid
//
// A Sticky used on canvases
//
// Markup:
// <div class="row">
// <div class="small-2 large-4 columns"><div class="kss-example-component">...</div></div>
// <div class="small-4 large-4 columns"><div class="kss-example-component">...</div></div>
// <div class="small-6 large-4 columns"><div class="kss-example-component">...</div></div>
// </div>