Skip to content

Instantly share code, notes, and snippets.

View coderberry's full-sized avatar

Eric Berry coderberry

View GitHub Profile
@coderberry
coderberry / MaskedTextField.jsx
Last active May 27, 2017 18:18
MaskedTextField with material-ui
/** @jsx React.DOM */
var React = require('react')
, mui = require('material-ui')
, { TextField } = mui
, $ = require('jquery');
require('jquery.inputmask');
var MaskedTextField = React.createClass({
var webpack = require('webpack');
module.exports = {
entry: './client_app/main.js',
output: {
filename: './app/assets/javascripts/bundle.js'
},
module: {
loaders: [
{test: /\.less$/, loader: 'style-loader!css-loader!less-loader'},
def state_hash
{"Alabama" => "AL",
"Alaska" => "AK",
"Arizona" => "AZ",
"Arkansas" => "AR",
"California" => "CA",
"Colorado" => "CO",
"Connecticut" => "CT",
"Delaware" => "DE",
"District of Columbia" => "DC",
@coderberry
coderberry / file-template.js
Last active May 2, 2017 05:54
Webstorm React Element Live Template and File Template
var React = require('react');
var ${NAME} = React.createClass({
render: function() {
return (
<div className="${NAME}">
</div>
)
}
});
@coderberry
coderberry / createStore.js
Created October 27, 2014 15:09
createStore
var EventEmitter = require('events').EventEmitter
, mergeInto = require('react/lib/mergeInto');
function createStore(initialState) {
var events = new EventEmitter();
var state = initialState || {};
return {
setState: function(newState) {
@coderberry
coderberry / simple-twitter.rb
Created October 21, 2014 18:56
Application oauth2 for Twitter using Ruby
require 'oauth'
require 'httpclient'
require 'json'
class SimpleTwitter
def initialize(config)
@config = config
@http_client = HTTPClient.new
end
@coderberry
coderberry / IqweA.markdown
Created September 24, 2014 16:47
A Pen by Eric Berry.

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@coderberry
coderberry / static-proxy.js
Created August 15, 2014 14:21
Proxy express app which allows passthrough requests (in order to maintain static IP)
// BASE SETUP
// =============================================================================
// call the packages we need
var express = require('express'); // call express
var app = express(); // define our app using express
var bodyParser = require('body-parser'); // allows parsing of post params
var request = require('request'); // enable performing http requests
// configure app to use bodyParser()
<!DOCTYPE html>
<html>
<head>
<title>Angular Casts</title>
<%= stylesheet_link_tag "application", media: "all" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %>