Skip to content

Instantly share code, notes, and snippets.

View kaievns's full-sized avatar

Kai Evans kaievns

  • Sydney, Australia
View GitHub Profile
import { field, TextInput } from 'a-plus-forms';
@field()
class PhoneInput extends React.Component {
onChange = (text) => {
const phoneNumber = format(text); // to phone number
this.props.onChange(phoneNumber);
}
render() {
@kaievns
kaievns / index.html
Created December 7, 2017 04:37
blog post
<form action="/signin">
<input type="text" name="username" />
<input type="password" name="password" />
<button type="submit">Sign In</button>
</form>
const connect = (mapStateToProps, mapDispatchToProps) => magic ...
const MegaLopolos = (props) =>
<div>
Stuff....
</div>
export defaults connect(mapStateToProps, mapDispatchToProps)(cssModules(styles)(MegaLopolos));
@kaievns
kaievns / Procfile
Created January 16, 2014 00:41
Makes zeus to run all your ruby processes through a Procfile
zeus: echo "Spawining Zeus..." && zeus start &> /dev/null
resque1: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=*
resque2: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=*
resque3: sleep 2 && zeus rake resque:work RAILS_ENV=development COUNT=1 QUEUE=*
web: sleep 2 && zeus server
@kaievns
kaievns / gist:7701961
Created November 29, 2013 05:30
Brutus on the walk
require 'curses'
class Engine
def self.inst
@inst
end
def self.inst=(inst)
@inst = inst
@kaievns
kaievns / gist:6228359
Created August 14, 2013 05:53
How to enable nested `feature` constructions in the `rspec` features
#
# Put this somwehere in your `spec/support` folder, then you can do something like that
#
# feature "Stuff" do
# feature 'new' do
# scenario 'user goes in and gets awesomized' do
# end
#
# scenario 'user goes in with evil intentions and doesn't get awesomized' do
# end
@kaievns
kaievns / gist:3158011
Created July 22, 2012 02:38
Paperclip mongoid support that works with mongoid 3
#
# Save this into your `lib/mongoid/paperclip.rb` file
#
#
require "paperclip"
module Paperclip
class << self
data: function() {
return {
trend : this.model.trend,
subtrend : this.model,
next_subtrend : this.model.nextSubtrend(),
next_trend : this.model.trend.nextTrend()
};
}
@kaievns
kaievns / gist:1509909
Created December 22, 2011 10:54
CSS3 Links without icons
a.add, a.edit, a.delete
&:before
margin-right: .25em
a.add:before
content: "\271A"
a.edit:before
content: "\270E"
@kaievns
kaievns / gist:1497611
Created December 19, 2011 15:11
Gradient Buttons The Right Way
// This way you can change the buttons color with a simple `background-color` setting
// without need to regenerate the whole gradient
input[type=button], input[type=submit], button
font-family: Arial, Helvetica
color: #333
border: 1px solid #ccc
border-radius: .25em
text-shadow: 0 1px 1px rgba(0,0,0,.3)