Skip to content

Instantly share code, notes, and snippets.

View richardjortega's full-sized avatar

Richard Ortega richardjortega

View GitHub Profile
@richardjortega
richardjortega / git_global_settings.md
Created April 11, 2014 16:29
Easy Git global settings to make your life easier

Set your name and email for your commit messages

$ git config --global user.name "John Doe"
$ git config --global user.email [email protected]

Exclude git tracking UNIX file permissions: Unix file permissions modes (755=rwxrw_rw_, 644=rw_r__r__) - the old mode included the +x (executable) flag, the new mode doesn't. http://code.google.com/p/msysgit/issues/detail?id=164

@richardjortega
richardjortega / currency.php
Last active April 24, 2016 23:59
Psysh Install CodeUp
<?php
echo "Enter the amount in US dollars: $";
$money = read_stdin();
echo "What currency do you want to convert to? (E)uros, (P)esos, (B)ritish Pounds: ";
$currency = strtoupper(read_stdin());
$converted = convert($money, $currency);
@richardjortega
richardjortega / psysh.md
Created March 18, 2014 16:33
PsySH Install

Install:

$ brew update && brew install composer
$ composer global require psy/psysh
# If asked what version constraint to use just type `*`

Update Your PATH for global CLI use:

@richardjortega
richardjortega / currency.php
Last active August 29, 2015 13:57
currency phpeople challenge
<?php
require('/Users/richardjortega/.composer/vendor/autoload.php');
echo "Enter the amount in US dollars: $";
$money = read_stdin();
echo "What currency do you want to convert to? (E)uros, (P)esos, (B)ritish Pounds: ";
$currency = strtoupper(read_stdin());
@richardjortega
richardjortega / redis_install.sh
Created June 6, 2013 03:28
Super easy REDIS install with brew
# install Redis on Mac OS X
$ brew update
$ brew install redis
# Caveats
# To have launchd start redis at login:
# ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
# Then to load redis now:
# launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
require_relative "../marketinglist/upload_csv_to_db.rb"
## You would run this with: $ rake myrakes:upload_blast_list
namespace :myrakes do
desc "Uploads a given CSV file to ActiveRecord table: Blast"
task :upload_blast_list => :environment do
#Uncomment blast to delete all prior data
puts "Dropping data from Blasts table"
Blast.delete_all
@richardjortega
richardjortega / assocation.rb
Created March 13, 2013 18:26
testing multiple models through same has_many :through assocation
## I need to have a Group that can consist of Users and/or Companies
class User
has_many :relationships
has_many :companies, :through => :relationships
end
class Relationships
belongs_to :user
belongs_to :company
@richardjortega
richardjortega / index.html.erb
Created October 19, 2012 21:26
Payment page
<!-- to display errors returned by createToken -->
<span class="payment-errors"></span>
<%= form_for @subscription, :html => { :class => 'payment-form', :id => 'payment-form' } do |f| %>
<%= f.hidden_field :stripe_card_token %>
<%= f.hidden_field :last_four %>
<noscript>
<p>This form requires Javascript to use</p>
@richardjortega
richardjortega / hooks_controller.rb
Created June 5, 2012 16:03
webhooks_controller_stripe
class HooksController < ApplicationController
protect_from_forgery :except => :receiver
require 'json'
require 'stripe'
#Hooks can only be used with a live URL
# Recommended testing options:
## pagekite.me - free trial