Skip to content

Instantly share code, notes, and snippets.

View bradylove's full-sized avatar

Brady Love bradylove

  • Pivotal
  • Highlands Ranch, CO
View GitHub Profile
puts "This is a test for my gist-runner mini-app"
require 'net/http'
uri = URI(ARGV[0])
gist = nil
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true if uri.scheme == 'https'
http.start do |h|
data = h.request Net::HTTP::Get.new(uri.request_uri)
module Silenceable
class << self
def silenceable
yield
end
def silenced?(file_path = Rails.root + ".silenced")
File.exists?(file_path)
end
end
# Gemfile
gem 'silenceable'
# view.html.haml
= link_to "Enable Silenceable", enable_silenceable_path
= Silenceable do
#some-div
Some Content in the #some-div container
require 'pry'
require './sample'
require 'ruby_parser'
require 'sexp_processor'
class Parser < SexpProcessor
def initalize
super
self.strict = false
end
docr String do
doc :to_s do
description "Hello World!"
path "/sessions/:id/string"
arguments public_name: "Description of public name",
initial_value: "Description of initial value"
example do
puts "some_string".to_s
# C-a as a prefix; similar to GNU screen
set -g prefix C-a
unbind C-b
# Shorter command delay; apparently otherwise vim is unhappy
set -sg escape-time 1
# 1-based window indexes
set -g base-index 1
setw -g pane-base-index 1
@bradylove
bradylove / stuff.rb
Last active December 11, 2015 19:48
class Images
# Attributes: :remote_image_url, :uuid
belongs_to :user, through: :profile_images
belongs_to :aquarium, through: :aquarium_images
end
class ProfileImage
# Attributes: :user_id, :image_id
belongs_to :user
has_one :image
;; Some methods for controlling Spotify from within Emacs
;; For OSX
;; Get the osascript from https://github.com/dronir/SpotifyControl
;; Create file in /usr/bin/spotify with the following contents
;;
;; #! /usr/bash
;; osascript /Users/brady/Scripts/SpotifyControl.scpt "$1"
;;
;; For linux, no additional files are needed :)
module MyApp
# If app is using rails you can replace the next 2 methods with
# mattr_accessor :application_id
@@application_id = nil
def self.application_id
@@application_id
end
def self.application_id=(id)