Skip to content

Instantly share code, notes, and snippets.

View baisa's full-sized avatar

Barbara Slawinska baisa

View GitHub Profile
class Temperature
def initialize (tempratures_hash)
@tempratures = tempratures_hash
end
def in_fahrenheit
puts @temperatures
@tempratures.key(:f) ? @tempratures[:f] : (@tempratures[:c] * 9.0 / 5) + 32
array = [['Number', 'Name'], [1, 'Foo'], [2, 'Bar'], [3, 'Baz']]
pretty_table(array)
# printed result:
+--------+--------+
| Number | Name |
+--------+--------+
| 1 | Foo |
array = [['Number', 'Name'], [1, 'Foo'], [2, 'Bar'], [3, 'Baz']]
def pretty_table(array)
new_array = array.collect {|elem|
elem.collect! {|el| el.to_s}
elem.max_by {|el| el.length}
}
m = new_array.max_by {|elem| elem.length}
@baisa
baisa / obj.js
Created November 10, 2013 20:39
function Person(name,age) {
this.name = name;
this.age = age;
}
// Let's make bob and susan again, using our constructor
var bob = Person("Bob Smith", 30);
var susan = new Person("Susan Jordan", 25);
console.log(bob)
console.log(this.name)
Started GET "/auth/twitter" for ::1 at 2016-06-29 16:26:19 +0100
I, [2016-06-29T16:26:19.128118 #15891] INFO -- omniauth: (twitter) Request phase initiated.
OAuth::Unauthorized - 400 Bad Request:
oauth (0.5.1) lib/oauth/consumer.rb:217:in `token_request'
oauth (0.5.1) lib/oauth/consumer.rb:136:in `get_request_token'
omniauth-oauth (1.1.0) lib/omniauth/strategies/oauth.rb:28:in `request_phase'
omniauth-twitter (1.2.1) lib/omniauth/strategies/twitter.rb:61:in `request_phase'
omniauth (1.3.1) lib/omniauth/strategy.rb:215:in `request_call'
omniauth (1.3.1) lib/omniauth/strategy.rb:183:in `call!'
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
ret := make([][]uint8, dy)
for y := 0; y < dy; y++ {
row := make([]uint8, dx)
for x := 0; x < dx; x++ {
row[x] = uint8(y)
@baisa
baisa / hello_world.rb
Created May 8, 2019 11:07
Hello World Examples
May already
@baisa
baisa / super_gist
Created May 8, 2019 11:13
Hello World Examples
hamburger
@baisa
baisa / super_gist
Created May 9, 2019 20:12
Hello World Examples
ddd
@baisa
baisa / super_gist
Created May 9, 2019 20:16
Hello World Examples
czy dziala