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
| s.gsub(/(.{1,78})(?: +|$)\n?|(.{78})/, "\\1\\2\n") |
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 'tweetstream' | |
| TweetStream.configure do |config| | |
| config.consumer_key = 'AA' | |
| config.consumer_secret = 'BB' | |
| config.oauth_token = 'CC' | |
| config.oauth_token_secret = 'DD' | |
| config.auth_method = :oauth | |
| 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
| ENV['RAILS_ENV'] = 'development' | |
| require '/Users/pioz/Code/ecommerce/config/application.rb' | |
| app = Megiston::Application.initialize! | |
| session = ActionDispatch::Integration::Session.new(app) | |
| session.get '/' | |
| puts session.body |
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 'win32ole' | |
| def inputbox(message, title = '') | |
| sc = WIN32OLE.new("ScriptControl") | |
| sc.language = "VBScript" | |
| sc.eval("Inputbox(\"#{message}\", \"#{title}\")") | |
| end | |
| def popup(message) | |
| wsh = WIN32OLE.new('WScript.Shell') |
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 'rubygems' | |
| require 'mechanize' | |
| require 'nokogiri' | |
| agent = Mechanize.new | |
| # Do login | |
| page = agent.get('http://monster-wow.com/') | |
| form = page.form_with(:name => 'login_form') | |
| form.username = ARGV[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
| int | |
| add (int a, int b) | |
| { | |
| int gen = a & b; // carries | |
| int pro = a ^ b; // sum | |
| gen |= pro & (gen << 1); | |
| pro = pro & (pro << 1); | |
| gen |= pro & (gen << 2); | |
| pro = pro & (pro << 2); | |
| gen |= pro & (gen << 4); |
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
| typedef unsigned long long bboard; // 64 bit unsigned integer | |
| bboard | |
| get (bboard b, int square) | |
| { | |
| return (b & (1ULL << square)); | |
| } |
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 'Qt' | |
| require 'qtwebkit' | |
| class Viewer < Qt::WebView | |
| slots 'change_h1()' | |
| def initialize(parent = nil) | |
| super(parent) | |
| connect(self, SIGNAL('loadFinished(bool)'), self, SLOT('change_h1()')) |
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 'zip/zip' | |
| module Zip | |
| def self.create(filename, *files) | |
| Zip::ZipFile.open(filename, Zip::ZipFile::CREATE) do |zip| | |
| files.each { |file| add(zip, file) } | |
| 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
| kill `ps ax | grep -v grep | grep -e "unicorn_rails .*-p 3000" | awk 'NR==1{print $1}'` |