Skip to content

Instantly share code, notes, and snippets.

@kenrick
kenrick / Testify.rb
Last active October 3, 2015 20:37
A Sample test from rspec
describe "Articles" do
it "creates a new article" do
article = create(:article)
visit new_article_path
fill_in "Name", :with => article.name
fill_in "Content", :with => article.content
click_button "Create Article"
page.should have_content("Article was successfully created.")
end
end
@kenrick
kenrick / install_ruby.sh
Created June 14, 2012 04:24
Install Ruby and Chef to Ubuntu Box
#!/usr/bin/env bash
sudo apt-get -y update
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev
cd /tmp
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz
tar -xvzf ruby-1.9.3-p125.tar.gz
cd ruby-1.9.3-p125/
./configure --prefix=/usr/local
make
make install
@kenrick
kenrick / cent_os.sh
Created June 16, 2012 23:32
Setup Cent OS Server
#!/usr/bin/env bash
yum -y update
yum -y install httpd
yum -y install php
yum -y install mysql
yum -y install mysql-server
yum -y install php-mysql
#Turn on services on restart
/sbin/chkconfig httpd on
@kenrick
kenrick / web_config.xml
Last active October 7, 2015 00:58
Wordpress IIS Config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rewrite to index.php">
<match url="index.php|robots.txt|images|test.php" />
<action type="None" />
</rule>
<rule name="Rewrite CI Index">
@kenrick
kenrick / show_errors.php
Created January 5, 2013 15:41
Forces the showing of errors in php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
error_reporting(E_ALL);
<?php
$code = base64_encode( json_encode ( array(1, 2, 3) ));
$array = json_decode( base64_decode ( $code ));
?>
angular.module("testApp", [])
.controller("testController", function ($scope) {
$scope.base = 1;
$scope.currency = "USD";
$scope.multiplyByBase = function(amount) {
var base = parseFloat($scope.base) ? $scope.base : 1;
return amount * base;
}
alert()
@kenrick
kenrick / es6
Created January 15, 2015 16:15
function* () {
var user = yield User.find(10);
var posts = yield Posts.where({ user_id: user.id });
console.log(user, posts);
};
FROM ruby:2.2.0
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev
RUN mkdir /signupsumo
WORKDIR /signupsumo
ADD Gemfile /signupsumo/Gemfile
ADD Gemfile.lock /signupsumo/Gemfile.lock
RUN bundle install
ADD . /signupsumo