Skip to content

Instantly share code, notes, and snippets.

View BaylorRae's full-sized avatar

Baylor Weathers BaylorRae

View GitHub Profile
@BaylorRae
BaylorRae / index.html.erb
Last active August 29, 2015 14:00
Category Links
<% Category.order(:title).each do |category| %>
<%= link_to category.title, category_products_path(category.id) %>
<% end %>
@BaylorRae
BaylorRae / Gemfile
Last active August 29, 2015 14:06
RFQuiltLayout with RubyMotion
gem 'motion-cocoapods'
@BaylorRae
BaylorRae / gist:564675
Created September 3, 2010 22:43
Wufoo API - getEntryCountToday
<?php
// Added inside of the WufooApiWrapper Class
public function getEntryCountToday($identifier, $from ='forms') {
$url = $this->getFullUrl($from.'/'.$identifier) . '?IncludeTodayCount=true';
// echo $url;
// die;
$this->curl = new WufooCurl();
@BaylorRae
BaylorRae / bcrypt.php
Created July 30, 2011 16:47 — forked from dzuelke/bcrypt.php
How to use bcrypt in PHP to safely store passwords (PHP 5.3+ only)
<?php
// secure hashing of passwords using bcrypt, needs PHP 5.3+
// see http://codahale.com/how-to-safely-store-a-password/
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt
// just an example; please use something more secure/random than sha1(microtime) :)
$salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22);
// 2a is the bcrypt algorithm selector, see http://php.net/crypt
@BaylorRae
BaylorRae / dabblet.css
Created December 21, 2011 19:57
Click open/close Dropdown in pure CSS
/* Click open/close Dropdown in pure CSS */
/* Disclaimer: Not the most semantic
thing in the universe. */
/* Forked from original idea
http://jsfiddle.net/paullferguson/Sv54G/3/ */
@BaylorRae
BaylorRae / search_params.php
Created December 22, 2011 16:07
Short Style for Arrays
<?php
/**
* Used for searching nested arrays
* Instead of `$user['profile']['avatar']['large']`
* It allows for `search_params($user, 'profile.avatar.large')
*
* Benefits
* - It checks if the value is set. if not returns null
* - makes sure the array is there.
@BaylorRae
BaylorRae / dabblet.css
Created December 23, 2011 18:32
Untitled
html {
background: #f2f2f2;
}
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
background: #fff;
padding: 20px;
margin: 40px;
@BaylorRae
BaylorRae / dabblet.css
Created January 11, 2012 18:34
Untitled
body {
margin: 100px 20px;
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
li {
margin-bottom: 10px;
}
class RockPaperScissors
attr_reader :result, :choice
def initialize(choice)
@choice = choice
if is_valid_choice?
@result = play
else
<?php
// connect to the db
$mysql = new mysqli('localhost', 'root', 'root', 'users');
/*
* This is the "official" object oriented way to do it,
* BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
*/
if ($mysql->connect_error) {