This file contains 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
package main | |
import ( | |
"log" | |
"net" | |
"os" | |
"github.com/gin-gonic/gin" | |
"github.com/sosedoff/geoip2-golang" | |
) |
This file contains 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 'rubygems' | |
require 'grooveshark' | |
gs = Grooveshark::Client.new | |
user = gs.login('USER', 'PASSWORD') | |
user.favorites.each do |s| | |
name = "#{s.id}_#{s.artist} - #{s.name}" | |
puts name | |
url = gs.get_song_url(s) |
This file contains 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 Rack | |
class Restrict | |
REGEX_MOBILE = /(blackberry|motorokr|motorola|sony|windows ce|240x320|176x220|palm|mobile|iphone|ipod|symbian|nokia|samsung|midp)/i | |
REGEX_BOTS = /(google|yahoo|baidu|bot|webalta|ia_archiver)/ | |
attr_reader :options | |
def initialize(app) | |
@app = app | |
end |
This file contains 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
__END__ | |
--- a/api/libsphinxclient/sphinxclient.c | |
+++ b/api/libsphinxclient/sphinxclient.c | |
@@ -277,7 +277,7 @@ | |
} | |
-void sock_close ( int sock ); | |
+static void sock_close ( int sock ); | |
This file contains 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 'RedCloth' | |
require 'rdiscount' | |
require 'rdoc/markup/to_html' # ruby1.9.2 specific | |
module TextMarkup | |
extend self | |
# Auto-detect format from filename and render content | |
def render(filename, content) | |
name = File.basename(filename.to_s.strip) |
This file contains 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 'omniauth/oauth' | |
require 'multi_json' | |
module OmniAuth | |
module Strategies | |
class Google2 < OAuth2 | |
def initialize(app, client_id = nil, client_secret = nil, options = {}, &block) | |
client_options = { | |
:site => 'https://accounts.google.com/o/oauth2', | |
:authorize_url => 'https://accounts.google.com/o/oauth2/auth', |
This file contains 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
have_library: checking for main() in -licui18n... -------------------- yes | |
"/usr/bin/gcc-4.2 -o conftest -I/Users/sosedoff/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/x86_64-darwin10.8.0 -I/Users/sosedoff/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1/ruby/backward -I/Users/sosedoff/.rvm/rubies/ruby-1.9.2-p290/include/ruby-1.9.1 -I. -I/usr/local/Cellar/icu4c/4.4.1/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe conftest.c -L. -L/Users/sosedoff/.rvm/rubies/ruby-1.9.2-p290/lib -L/usr/local/Cellar/icu4c/4.4.1/lib -L. -L/usr/local/lib -lruby.1.9.1-static -lpthread -ldl -lobjc " | |
checked program was: | |
/* begin */ | |
1: #include "ruby.h" | |
2: | |
3: int main() {return 0;} | |
/* end */ |
This file contains 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 Rack | |
class Revision | |
@@revision = nil | |
File = ::File | |
def initialize(app, &block) | |
@app = app | |
@block = block | |
@file = File.join(Dir.pwd, 'REVISION') | |
end |
This file contains 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' | |
module Yelp | |
PRICE_RANGE_REGEX = /<span id="price_tip" \b[^>]*>(.*?)<\/span>/i | |
def self.restaurant_price_range(id) | |
url = "http://www.yelp.com/biz/#{id}" | |
body = Faraday.get(url).body | |
body.scan(PRICE_RANGE_REGEX).flatten.first.to_s.length | |
end |
This file contains 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/ssh' | |
require 'net/ssh/shell' | |
require 'open3' | |
module Net | |
module SSH | |
class SessionCommand | |
attr_reader :command, :output, :exit_code | |
# Initialize a new session command |
OlderNewer