This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require 'benchmark' | |
| def graphite_test(host) | |
| system("echo 'ap.test.foo 1 #{Time.now.to_i}' | nc #{host} 2003") | |
| # send(metric_path value unix_timestamp) | |
| # example: send("foo.bar.baz my_value 12345678") | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'test_helper' | |
| class Api::UsersTest < ActionDispatch::IntegrationTest | |
| def setup | |
| host! 'api.host.com' | |
| end | |
| test 'get /v1/users/1.json' do | |
| user = users(:one) | |
| get "/v1/users/#{user.id}.json" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* global module:false */ | |
| var lrSnippet = require('connect-livereload')(); | |
| var proxySnippet = require('grunt-connect-proxy/lib/utils').proxyRequest; | |
| var rewriteRulesSnippet = require('grunt-connect-rewrite/lib/utils').rewriteRequest; | |
| var mountFolder = function (connect, dir) { | |
| return connect.static(require('path').resolve(dir)); | |
| }; | |
| module.exports = function(grunt) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uglify: { | |
| options: { | |
| mangle: false, | |
| banner: '<%= banner %>' | |
| }, | |
| /* | |
| * Example alternative to usemin automagicalness | |
| * | |
| dist: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| copy: { | |
| dist: { | |
| files: [ | |
| { | |
| expand: true, | |
| cwd: 'sinatra', | |
| src: ['**', '!public/js/**'], | |
| dest: '<%= dist_dir %>', | |
| filter: 'isFile' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| autoload -U colors && colors | |
| # between the local and remote branches | |
| function git_remote_status() { | |
| remote=${$(git rev-parse --verify ${hook_com[branch]}@{upstream} --symbolic-full-name 2>/dev/null)/refs\/remotes\/} | |
| if [[ -n ${remote} ]] ; then | |
| ahead=$(git rev-list $remote..HEAD 2>/dev/null | wc -l) | |
| behind=$(git rev-list HEAD..$remote 2>/dev/null | wc -l) | |
| if [ $ahead -eq 0 ] && [ $behind -eq 0 ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DEBUG = true | |
| def debug(message) | |
| puts "[#{Time.now}] #{caller[0][/`.*'/][1..-2]}::#{message}" if DEBUG | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| ## | |
| # Capitalize all directory names within a given path | |
| # | |
| # defaults to the current working directory if no supplied path | |
| base_dir = ARGV[0] || Dir.pwd | |
| Dir.chdir base_dir do | |
| dirs = Dir.glob('*').reject { |f| !File.directory?(f) } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| ## | |
| # Quickly sort related files in a given directory into | |
| # subdirectories of that same directory | |
| # | |
| # defaults to the current working directory if no supplied path | |
| require 'fileutils' | |
| base_dir = ARGV[0] || Dir.pwd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This works well enough for debugging | |
| # hax for irbrc | |
| class Object | |
| def imethods | |
| (self.methods - Object.instance_methods) | |
| end | |
| end |