Brainstorming a friendlier find(1).
Goals:
| 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 |
| $(function(){ | |
| var tokenValue = $("meta[name='csrf-token']").attr('content'); | |
| $.ajaxSetup({ | |
| headers: {'X-CSRF-Token': tokenValue} | |
| }); | |
| }) |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| SILENT = ENV['SL_SILENT'] =~ /false/i ? false : true || true | |
| VERSION = '2.2.23' | |
| # SearchLink by Brett Terpstra 2015 <http://brettterpstra.com/projects/searchlink/> | |
| # MIT License, please maintain attribution | |
| require 'net/https' | |
| require 'uri' |
| <?xml version="1.0"?> | |
| <root> | |
| <item> | |
| <name>Truly Ergonomic Keyboard</name> | |
| <!-- | |
| DIP switch settings: | |
| 1 2 3 4 5 |
| // Edit pinboard_user and pinboard_pass to your own settings below | |
| // copy the bookmarklet code and create a new bookmark with the code as the url | |
| // Run it on a page. If it works, hovering around the page will cause red outlines to appear | |
| // clicking on a section will grab all of the links in the innermost section and send them to pinboard | |
| // WARNING: may screw up and create a shitload of links in your Pinboard account | |
| // | |
| // Todo: rewrite w/o jQuery, better filtering of detected links, don't grab image links | |
| javascript:var user='pinboard_user',pass='pinboard_pass';(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="http://ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.7",function($,L){$(document).ready(functi |
| <?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: | |
| #!/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 |
| #!/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 |
| @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); |