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' | |
| # WARNING do not use this; it works but is very limited | |
| def resolve url | |
| res = Net::HTTP.get_response URI(url) | |
| if res.code == '301' then res['location'] | |
| else url.to_s | |
| 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
| require 'faraday_middleware' | |
| require 'hashie/mash' | |
| # Public: GeoIP service using freegeoip.net | |
| # | |
| # See https://github.com/fiorix/freegeoip#readme | |
| # | |
| # Examples | |
| # | |
| # res = GeoipService.new.call '173.194.64.19' |
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 'tempfile' | |
| require 'fileutils' | |
| # Signals | |
| trap("SIGINT") { exit } | |
| # Setup | |
| TARGET_FOLDER = ARGV[0] | |
| TARGET_URL = ARGV[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
| #!/bin/bash | |
| SOURCE_USER=user | |
| SOURCE_HOST=localhost | |
| SOURCE_PASSWORD='password' | |
| SOURCE_DATABASE=database | |
| TARGET_USER=user | |
| TARGET_HOST=localhost | |
| TARGET_PASSWORD='password' |
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
| alias subo='sudo' | |
| alias bungle='bundle' | |
| alias lcok='lock' | |
| alias touch='say "cant touch this, da, da, da, da, duh, der, der, da"; touch' |
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
| # Save this file in ~/Library/Application Support/Sublime Text 2/Packages/User | |
| import sublime, sublime_plugin | |
| class DefaultSyntaxCommand(sublime_plugin.EventListener): | |
| def on_new(self, view): | |
| view.set_syntax_file('JavaScript/JavaScript.tmLanguage') |
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
| // Listing bookmarks with a collection: | |
| var BookmarksCollection = SignalBox.Backbone.Collection({ | |
| resource : 'bookmarks' | |
| }); | |
| var bookmarks = new BookmarksCollection; | |
| bookmarks.fetch({ | |
| success : function(collection){ |
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/ruby | |
| class HostsFile | |
| attr_accessor :lines | |
| def initialize(path = '/etc/hosts') | |
| @file = File.open(path, 'r') | |
| @entries = [] | |
| parse |
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
| // Setup the SDK | |
| SignalBox.setup({ | |
| app : 'sdk_test', | |
| username : 'signalboxdemo' | |
| }); | |
| // List all users |
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
| # Run this file with `RAILS_ENV=production rackup -p 3000 -s thin` | |
| # Be sure to have rails and thin installed. | |
| require "rubygems" | |
| require "rails" | |
| # Let's load only action controller. If you want | |
| # to use active record, just require it as well. | |
| require "action_controller/railtie" | |
| class MyApp < Rails::Application |