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
| puts "This is a test for my gist-runner mini-app" |
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 '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) |
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
| module Silenceable | |
| class << self | |
| def silenceable | |
| yield | |
| end | |
| def silenced?(file_path = Rails.root + ".silenced") | |
| File.exists?(file_path) | |
| end | |
| 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
| # Gemfile | |
| gem 'silenceable' | |
| # view.html.haml | |
| = link_to "Enable Silenceable", enable_silenceable_path | |
| = Silenceable do | |
| #some-div | |
| Some Content in the #some-div container |
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 'pry' | |
| require './sample' | |
| require 'ruby_parser' | |
| require 'sexp_processor' | |
| class Parser < SexpProcessor | |
| def initalize | |
| super | |
| self.strict = false | |
| 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
| 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 |
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
| # 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 |
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
| 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 |
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
| ;; 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 :) |
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
| 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) |