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 'mechanize' | |
require 'moving_average' | |
mechanize = Mechanize.new | |
login_page = mechanize.get 'https://www.myfitnesspal.com/account/login' | |
form = login_page.forms.first | |
# noinspection RubyResolve | |
form.field_with(id: 'username').value = "username" | |
form.field_with(id: 'password').value = "pass" | |
form.submit |
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 'socket' | |
require 'rack' | |
require 'sinatra' | |
# Simple, rack-compliant web server | |
class MyServer | |
STATUS_CODES = { | |
200 => 'OK', | |
500 => 'Internal Server Error' | |
} |
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 'formula' | |
class ErlangManuals < Formula | |
url 'http://erlang.org/download/otp_doc_man_R16B01.tar.gz' | |
sha1 '57ef01620386108db83ef13921313e600d351d44' | |
end | |
class ErlangHtmls < Formula | |
url 'http://erlang.org/download/otp_doc_html_R16B01.tar.gz' | |
sha1 '6741e15e0b3e58736987e38fb8803084078ff99f' |
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
# from ounce of elixir | |
#https://www.meetup.com/Women-Who-Code-Tampa/events/233014583/ | |
ExUnit.start | |
defmodule CartTest do | |
use ExUnit.Case | |
test "starts with empty count" do | |
assert Cart.count_items([]) == 0 |
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
app_name = ARGV[0] | |
initial_resource_name = ask('What is your initial resource ?') | |
remove_file 'Gemfile' | |
create_file 'Gemfile', <<-eos | |
source 'https://rubygems.org' | |
gem 'rails', '3.2.6' |
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
@implementation WhateverClass | |
+ (NSString *)getBasicAuth | |
{ | |
NSData *encodeData = [[NSString stringWithFormat:@"%@:%@", username, password] | |
dataUsingEncoding:NSUTF8StringEncoding]; | |
// from NSData+Base64.m by Matt Gallagher | |
NSString *credentials = [encodeData base64EncodedString]; |
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
namespace :assets do | |
desc "Check that all assets have valid encoding" | |
task :check => :environment do | |
paths = ["app/assets", "lib/assets", "vendor/assets"] | |
extensions = ["js", "coffee", "css", "scss"] | |
paths.each do |path| | |
dir_path = Rails.root + path |
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
diff -U 0 -r rails-3.1.0.rc4/Gemfile rails-3.1.1/Gemfile | |
--- rails-3.1.0.rc4/Gemfile 2011-10-07 12:02:26.000000000 -0400 | |
+++ rails-3.1.1/Gemfile 2011-10-07 12:59:13.000000000 -0400 | |
@@ -3 +3 @@ | |
-gem 'rails', '3.1.0.rc4' | |
+gem 'rails', '3.1.1' | |
@@ -10,4 +10,8 @@ | |
-# Asset template engines | |
-gem 'sass-rails', "~> 3.1.0.rc" | |
-gem 'coffee-script' |
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
case "$rvm_ruby_string" in | |
*ruby-1.9.2*-patched) | |
export RUBY_HEAP_MIN_SLOTS=1000000 | |
export RUBY_HEAP_SLOTS_INCREMENT=1000000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=1000000000 | |
export RUBY_HEAP_FREE_MIN=500000 | |
export RUBY_FREE_MIN=$RUBY_HEAP_FREE_MIN | |
;; | |
*) |