Skip to content

Instantly share code, notes, and snippets.

Justin Hileman bobthecow

Block or report user

Report or block bobthecow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@dblock
dblock / api_logger.rb
Created Dec 10, 2012
API logger with Grape under Rails
View api_logger.rb
class ApiLogger < Grape::Middleware::Base
def before
Rails.logger.info "[api] Requested: #{request_log_data.to_json}\n" +
"[api] #{response_log_data[:description]} #{response_log_data[:source_file]}:#{response_log_data[:source_line]}"
end
private
def request_log_data
@justinperkins
justinperkins / jquery-auth-token.js
Created Oct 26, 2012
Put auth-token on all jQuery Ajax Requests
View jquery-auth-token.js
$(function(){
var tokenValue = $("meta[name='csrf-token']").attr('content');
$.ajaxSetup({
headers: {'X-CSRF-Token': tokenValue}
});
})
@ttscoff
ttscoff / searchlink.rb
Last active Jan 26, 2020
SearchLink creates Markdown links from automatic searches based on special syntax.
View searchlink.rb
View gist:3855290
<?xml version="1.0"?>
<root>
<item>
<name>Truly Ergonomic Keyboard</name>
<!--
DIP switch settings:
1 2 3 4 5
@ttscoff
ttscoff / grablinks.js
Created Sep 30, 2012
Bookmarklet to send all links within clicked div/table to Pinboard
View grablinks.js
View AgaviMustacheRenderer.class.php
<?php
// +---------------------------------------------------------------------------+
// | This file is part of the Agavi package. |
// | Copyright (c) 2012 Parspooyesh co. |
// | |
// | For the full copyright and license information, please view the LICENSE |
// | file that was distributed with this source code. You can also view the |
// | LICENSE file online at http://www.agavi.org/LICENSE.txt |
// | vi: set noexpandtab: |
@ttscoff
ttscoff / planter.rb
Created Sep 22, 2012
Create directory trees from indented text input
View planter.rb
#!/usr/bin/ruby
=begin
Planter v1.3
Brett Terpstra 2013
ruby script to create a directory structure from indented data.
Three ways to use it:
- Pipe indented (tabs or 2 spaces) text to the script
- e.g. `cat "mytemplate" | planter.rb
- Create template.tpl files in ~/.planter and call them by their base name
@sjl
sjl / ffind.md
Created Sep 19, 2012
friendly-find
View ffind.md

friendly-find

Brainstorming a friendlier find(1).

Usage

Goals:

@ttscoff
ttscoff / flavor.rb
Created Sep 16, 2012
Quick wrapper to convert Markdown to HTML via Github API
View flavor.rb
#!/usr/bin/ruby
# Convert a Markdown README to HTML with Github Flavored Markdown
# Github and Pygments styles are included in the output
#
# Requirements: json gem (`gem install json`)
#
# Input: STDIN or filename
# Output: STDOUT
# Arguments: "-c" to copy to clipboard (or "| pbcopy"), or "> filename.html" to output to a file
# cat README.md | flavor > README.html
@KuraFire
KuraFire / rgbaa.scss
Created Sep 13, 2012
More dynamic, oldIE-compatible SCSS function for rgba
View rgbaa.scss
@function rgbaa($args...) {
// rgbaa(#FFF, .5)
@if length($args) == 2 {
$hex: nth($args, 1);
$alpha: nth($args, 2);
@if $oldIE == 1 {
@return rgb(red($hex), green($hex), blue($hex));
} @else {
@return rgba(red($hex), green($hex), blue($hex), $alpha);
You can’t perform that action at this time.