Skip to content

Instantly share code, notes, and snippets.

View kathgironpe's full-sized avatar

Katherine Giron Pe kathgironpe

View GitHub Profile
@kathgironpe
kathgironpe / reducers.js
Created October 27, 2016 13:11 — forked from gaearon/reducers.js
How I'd do code splitting in Redux (pseudo code, not tested!)
import { combineReducers } from 'redux';
import users from './reducers/users';
import posts from './reducers/posts';
export default function createReducer(asyncReducers) {
return combineReducers({
users,
posts,
...asyncReducers
});

#Phoenix 1.1.x to 1.2.0 Upgrade Instructions

Project Generator

To generate new projects as 1.2.0, install the new mix archive:

mix archive.install https://github.com/phoenixframework/archives/raw/master/phoenix_new.ez

Deps

Rate limiting with Redis

June 2011 - Chris O'Hara - (archived original post)

Rate limiting can be an effective way of conserving resources and preventing automated or nefarious activities on your site.

A common use case is to limit the amount of requests an IP can make over a certain time frame. For example, you might want to restrict users from using an expensive search utility on your site. If the user attempts to search more than 5 times a minute, you can redirect them to another page informing them that they need to wait.

IP based rate limiting is already in use on larger sites. Google and Yahoo both employ the technique to prevent (or at least complicate) automated requests to their services.

@kathgironpe
kathgironpe / gist:c0c733793bd984ae6f7195846f2c0aba
Created September 27, 2016 04:52 — forked from ryansobol/gist:5252653
15 Questions to Ask During a Ruby Interview

Originally published in June 2008

When hiring Ruby on Rails programmers, knowing the right questions to ask during an interview was a real challenge for me at first. In 30 minutes or less, it's difficult to get a solid read on a candidate's skill set without looking at code they've previously written. And in the corporate/enterprise world, I often don't have access to their previous work.

To ensure we hired competent ruby developers at my last job, I created a list of 15 ruby questions -- a ruby measuring stick if you will -- to select the cream of the crop that walked through our doors.

What to expect

Candidates will typically give you a range of responses based on their experience and personality. So it's up to you to decide the correctness of their answer.

@kathgironpe
kathgironpe / HashableType.swift
Created September 11, 2016 05:49 — forked from scotteg/HashableType.swift
A Swift HashableType that enables nesting a Set of any Hashable type within a Set
func ==(x: HashableType, y: HashableType) -> Bool {
return x.isEqual(y.value)
}
struct HashableType: Hashable {
let value: Any
var hashValue: Int {
return getHashValue()
}
@kathgironpe
kathgironpe / rails http status codes
Created July 30, 2016 04:11 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@kathgironpe
kathgironpe / .bashrc
Created July 13, 2016 09:27 — forked from vsouza/.bashrc
Golang 1.5 setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@kathgironpe
kathgironpe / mruby.sh
Last active December 11, 2015 06:00
MRuby
## Installation Through Rbenv
rbenv install -l | grep mruby
rbenv install mruby-1.1.0
rbenv shell mruby-1.1.0
// Media Queries in Sass 3.2
//
// These mixins make media queries a breeze with Sass.
// The media queries from mobile up until desktop all
// trigger at different points along the way
//
// And important point to remember is that and width
// over the portrait width is considered to be part of the
// landscape width. This allows us to capture widths of devices
// that might not fit the dimensions exactly. This means the break