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
begin | |
loop do | |
puts "in loop" | |
if o = IO.select([input, ssl_socket].compact, nil, nil, activity_timeout) | |
puts "in select if" | |
if (input && (o.first.first == input)) | |
puts "in if" | |
data = input.readpartial(10000) | |
puts "read partial" | |
ssl_socket.write(data) |
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
class BigDecimal | |
def inspect | |
to_s | |
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
christmas_present.price #=> #<BigDecimal:7ff71b93df40,'0.123E3',9(18)> |
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
christmas_present.price #=> "123.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
git log --pretty="%ad|%an|%s" --date=short | | |
while IFS='|' read date author message | |
do | |
printf '%s %-20s %s\n' "$date" "$author" "$message" | |
done |
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
log = [ | |
{time: 201201, x: 2}, | |
{time: 201201, y: 7}, | |
{time: 201201, z: 2}, | |
{time: 201202, a: 3}, | |
{time: 201202, b: 4}, | |
{time: 201202, c: 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
[ | |
{time: 201201, x: 2, y: 7, z: 2}, | |
{time: 201202, a: 3, b: 4, c: 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
class Auth0Token | |
def request_token | |
connection = Faraday.new(url: "https://rubyfriend.auth0.com/oauth/token") | |
response = connection.post do |request| | |
request.headers['Content-Type'] = 'application/json' | |
request.body = payload.to_json | |
end | |
JSON.parse(response.body) | |
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
#!/bin/bash | |
set -e | |
set -o pipefail | |
for dev in /dev/sd? | |
do | |
if findmnt "${dev}1" | |
then | |
umount "${dev}1" |
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
WITH relations AS (SELECT | |
a.attname, | |
pg_catalog.format_type(a.atttypid, a.atttypmod) AS type, | |
t.relname | |
FROM | |
pg_attribute a | |
JOIN pg_class t ON a.attrelid = t.oid | |
JOIN pg_namespace s ON t.relnamespace = s.oid | |
WHERE | |
a.attnum > 0 |