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
// runtest.io | |
TestSuite clone setPath(System launchPath) run |
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
foo := block(str, | |
str asMutable asCapitalized println | |
) | |
foo call("my awesome string") // ==> My awesome string | |
foo message // ==> str asMutable asCapitalized println | |
foo message next // ==> asMutable asCapitalized println | |
foo message next next // ==> asCapitalized println | |
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
adaniele@nutcracker:~/ironruby$ mono bin/ir.exe | |
IronRuby 1.0.0.1 on .NET 2.0.50727.42 | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Note that local variables do not work today in the console. | |
As a workaround, use globals instead (eg $x = 42 instead of x = 42). | |
>>> puts 'hello' | |
hello | |
=> nil |
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
// Parsing posts from tumblr using JSON | |
JSON | |
Regex | |
Map squareBrackets := method( | |
return self at(call evalArgs at(0)) | |
) | |
URL with("http://staff.tumblr.com/api/read/json") fetch findRegex("^var tumblr_api_read = (.*);\s*$") ?at(1) fromJSON ["posts"] foreach(post, post ["type"] println) |
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
http = require "socket.http" | |
require "json" | |
local json_res = http.request("http://staff.tumblr.com/api/read/json") | |
local tumblr = json.decode(string.match(json_res, "^var tumblr_api_read = (.*);%s*$")) | |
for _, post in ipairs(tumblr.posts) do print(post.type) end | |
--[[ **** OUTPUT **** |
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
IronRuby 1.0.0.0 on .NET 2.0.50727.1433 | |
Copyright (c) Microsoft Corporation. All rights reserved. | |
Note that local variables do not work today in the console. | |
As a workaround, use globals instead (eg $x = 42 instead of x = 42). | |
>>> require 'mscorlib' | |
=> true | |
>>> require 'Win32API' | |
=> true |
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
irb(main):001:0> require 'Win32API' | |
=> true | |
irb(main):002:0> $get_logical_drives = Win32API.new('kernel32', 'GetLogicalDriveStrings', ['P', 'P'], 'I') | |
=> #<Win32API:0x2e2a200> | |
irb(main):003:0> $buffer = ' ' * 32 | |
=> " " | |
irb(main):004:0> $length = $get_logical_drives.call($buffer.length, $buffer) | |
=> 16 | |
irb(main):005:0> $buffer | |
=> "A:\\\000C:\\\000D:\\\000S:\\\000\000 " |
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 'Win32API' | |
module NetworkDrive | |
CONNECT_UPDATE_PROFILE = 0x1 | |
RESOURCE_CONNECTED = 0x1 | |
RESOURCE_GLOBALNET = 0x2 | |
RESOURCETYPE_DISK = 0x1 | |
RESOURCEDISPLAYTYPE_SHARE = 0x3 | |
RESOURCEUSAGE_CONNECTABLE = 0x1 | |
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 'httparty' | |
class CouchDB | |
include HTTParty | |
base_uri '172.22.107.12:5984' | |
format :json | |
def self.info | |
get '/' |
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' | |
require 'net/https' | |
post_url = URI.parse('https://my.host.name/path/to/post') | |
request = Net::HTTP::Post.new(post_url.path) | |
request.set_form_data({ | |
'name' => 'nrk', | |
'test' => '1', | |
# ... |
OlderNewer