Skip to content

Instantly share code, notes, and snippets.

View blairanderson's full-sized avatar

Blair Anderson blairanderson

View GitHub Profile
@blairanderson
blairanderson / multi-nav.html
Created August 14, 2013 05:49
just a couple'a navs, hangin out. http://jsfiddle.net/rz85X/18/
<div class="navbar">
<div class="navbar-inner">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".col2">groups2</a>
<a class="btn btn-navbar" data-toggle="collapse" data-target=".col1">groups</a>
<div class="nav-collapse col1">
<ul class="nav">
<li><a href="#">Nav Link</a></li>
<li><a href="#">Nav Link</a></li>
<li><a href="#">Nav Link</a></li>
<li><a href="#">Nav Link</a></li>
@blairanderson
blairanderson / runner.rb
Created September 26, 2013 15:55
@quickleft #hackfest code for MakeyMakey to Twilio
# encoding: utf-8
require 'rubygems' # not necessary with ruby 1.9 but included for completeness
require 'twilio-ruby'
# put your own credentials here
account_sid = 'ABCABCABCABCABCABCABCABCABCABCABC'#GET YOUR OWN TOKENS FROM TWILIO
auth_token = 'ABCABCABCABCABCABCABCABCABCABCABC' #GET YOUR OWN TOKENS FROM TWILIO
# set up a client to talk to the Twilio REST API
@blairanderson
blairanderson / word.rb
Last active December 25, 2015 01:39
remove duplicate characters
class Word
attr_reader :count, :word
def initialize(word)
@word = word
@count = word.length
end
def simplified
count.times do
match = word.match(/(\w)\1+/)
@blairanderson
blairanderson / post.js
Created October 17, 2013 00:48
Rails AJAX(remote true) Form with Custom Errors I had a form that I needed to submit with ajax, use the server to validate, then handle responses on the client. I wanted a solution that was basically agnostic to the page. Would love to see other solutions...
$( document ).ready(function() {
$("form[data-remote]").on("ajax:success", function(e, data, status, xhr) {
console.log('success, yall');
$("form[data:remote]").append(xhr.responseText);
}).bind("ajax:error", function(e, xhr, status, error) {
$('.errors').detach(); // removes any previous errors
@blairanderson
blairanderson / _thing.html.erb
Last active December 26, 2015 01:59
rendering a collection to a partial, but I want to have the layout be different for even and odd records that are rendered out. https://gist.github.com/blairanderson/7075515
<% if thing_counter.even? %>
<div class="wide">
<h2>Header</h2>
<p class="lead"></p>
</div>
<div class="narrow">
<%= image_tag thing.image %>
</div>
<% else %>
<div class="narrow">
<iframe frameborder="0"
scrolling="no"
marginheight="0"
marginwidth="0"
src="https://maps.google.com/maps?q=902+Pearl+Street+Boulder+CO&output=embed"></iframe>
@blairanderson
blairanderson / yahoo.js
Last active December 27, 2015 12:29
The old Yahoo Media player
/* This is the old yahoo media player code that was deprecated. */
(function () {
if (typeof n == "undefined" || !n) {
var n = {};
}
n.namespace = function () {
var i = arguments,
u = null,
w, x, v;
@blairanderson
blairanderson / experiment.scss
Created November 21, 2013 20:23
Fun with SCSS and bootstrap.
// Use bootstrap sass mixins in your scss instead of litering your view with bootstrap classes.
form.stuff{
input[type="submit"]{
// This is where we customize our submit button
@extend .btn;
@extend .btn-sm;
}
input[type="text"], input[type="password"] { // include more types if you want.
@extend .form-control;
@blairanderson
blairanderson / styling.less
Created January 11, 2014 01:16
css / less up/down arrows
.triangle-base(@size) {
content: '';
display: inline-block;
width: 0;
height: 0;
margin-left: 5px;
border-left: @size solid transparent;
border-right: @size solid transparent;
}
.triangle(@direction, @size: 7px, @color: #428bca) when (@direction = up) {
@blairanderson
blairanderson / open-mac-apps-unidentified-developer.markdown
Created March 27, 2014 16:41
How to Open Mac Apps from an Unidentified Developer
  1. Launch System Preferences and click on it. (type command + space and type 'system preferences')
  2. From here click on the Privacy & Security icon in the top row.
  3. The General tab is where we want to be.
  4. the lock-icon in the bottom left should look unlocked. If it is not, click on the lock and type in your password. This will allow you to make changes to your settings.
  5. click "Anywhere"

Anywhere will allow any app to be opened regardless of the source or developer.

Once you've made your changes, click the lock icon again and go ahead close the window(click the little red circle x in the top left) and exit out of System Preferences altogether.