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
puts 'Hello world.' |
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 "fmt" | |
func main() { | |
x := 1.0 | |
for ; (1 + x) > 1; x = x / 2 { } | |
fmt.Printf("%v\n", x * 2) | |
} |
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 'singleton' | |
# The gem's main module. | |
module AwesomeGem | |
# A class method which yields the configuration to a block. | |
def self.configure | |
yield Configuration.instance if block_given? | |
end | |
# A class method to access the configuration instance. |
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 'awesome_gem' | |
AwesomeGem.configure do |config| | |
config.do_magic = true | |
config.awesome_string = 'The most awesomest string.' | |
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
# OtherModule has the methods do_stuff_with and do_magic, | |
# which are like, super important, ok? | |
require 'other_module' | |
module AwesomeGem | |
class AwesomeClass | |
include OtherModule | |
do_stuff_with AwesomeGem.configuration.awesome_string | |
do_magic if AwesomeGem.configuration.do_magic? |
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 'singleton' | |
# The gem's main module. | |
module AwesomeGem | |
# A class method which yields the configuration to a block. | |
def self.configure | |
yield Configuration.instance if block_given? | |
# Call all the registered listeners after configuration has taken place! | |
Configuration.instance.listeners.each { |listener| listener.call } | |
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
# OtherModule has the methods do_stuff_with and do_magic, | |
# which are like, super important, ok? | |
require 'other_module' | |
module AwesomeGem | |
class AwesomeClass | |
include OtherModule | |
# Pass our method calls on a block, so they're called | |
# after the configuration has taken place. |
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
{ | |
"coord": { | |
"lon": -0.13, | |
"lat": 51.51 | |
}, | |
"weather": [ | |
{ | |
"id": 800, | |
"main": "Clear", | |
"description": "Sky is Clear", |
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 com.mycompany.myfirstapp.model.weather; | |
public class WeatherInfo { | |
private Weather[] weather; | |
private String name; | |
public Weather[] getWeather() { | |
return weather; | |
} |
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 com.mycompany.myfirstapp.model.weather; | |
public class Weather { | |
private String description; | |
public String getDescription() { | |
return description; | |
} |
OlderNewer