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
WITH constants AS ( | |
SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 4 AS ma | |
), bloat_info AS ( | |
SELECT | |
ma,bs,schemaname,tablename, | |
(datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr, | |
(maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2 | |
FROM ( | |
SELECT | |
schemaname, tablename, hdr, ma, bs, |
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 worker_record do | |
record = WorkerRecord[at: at, at_queue: at_queue] when is_number(at) and at > timestamp and is_bitstring(at_queue) -> | |
# do something | |
_ -> | |
# do something | |
end | |
## I get error: | |
## cannot invoke remote function Access.get/2 inside match |
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 --git samples/calculator/calculator.html samples/calculator/calculator.html | |
index 7f80d0c..acfd40b 100644 | |
--- samples/calculator/calculator.html | |
+++ samples/calculator/calculator.html | |
@@ -2,11 +2,7 @@ | |
<head> | |
<title>Calculator</title> | |
<link rel="stylesheet" type="text/css" href="style.css" /> | |
- <script src="jquery/jquery.min.js"></script> | |
- <script src="lovefield.js"></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
require 'net/pop' | |
raise "args shoud be email ans pass" if ARGV.length < 2 | |
username, password = ARGV[0], ARGV[1] | |
Net::POP3.start('mailtrap.io', 1100, username, password, true) do |pop| | |
if pop.mails.empty? | |
puts 'No mail.' | |
else | |
pop.each_mail do |m| |
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
telnet ruby-2.2.0 | |
telnet> toggle crlf | |
Will send carriage returns as telnet <CR><LF>. | |
telnet> open mailtrap.io 1100 | |
Trying 54.164.81.148... | |
Connected to mailtrap.io. | |
Escape character is '^]'. | |
+OK POP3 ready <190442990.1442953303@mailtrap.io> | |
USER *** | |
+OK |
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
2.2.0 :014 > s.puts "LIST\r" | |
=> nil | |
2.2.0 :015 > s.gets | |
=> "+OK 50 messages (4192565 octets)\r\n" | |
2.2.0 :016 > s.gets | |
=> "1 14181\r\n" | |
2.2.0 :017 > s.gets | |
=> "2 127\r\n" | |
2.2.0 :018 > s.gets | |
=> "3 127\r\n" |
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 "google_spreadsheet" | |
namespace :deploy do | |
desc "Notify GD" | |
task :gd_notify, :except => { :no_release => true } do | |
rails_env = fetch(:rails_env, "production") | |
local_user = ENV['USER'] || ENV['USERNAME'] | |
local_branch = fetch(:branch, "HEAD") | |
SPECIAL_TOKEN = 'SpecialTokenForSearch' |
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
#!/usr/bin/env ruby | |
SPECIAL_TOKEN = 'SpecialTokenForSearch' | |
WITHOUT_MERGES = "--no-merges" | |
GIT_COMMIT_LINK="https://github.com/some_projects/commit/:commit" | |
cmd = `git show-ref --tags` | |
tags = [] | |
cmd.each do |l| | |
tag_commit, tag_name = l.chomp.split(" ") |
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 'RMagick' | |
class ImageDiff | |
#max = 20 | |
MATRIX = 15 | |
def generate_array(image_path) | |
result = [] | |
main_img = Magick::Image.read(image_path).first |
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
<?php | |
class ImageDiff { | |
// not bigger 20 | |
private $matrix = 20; | |
public function getImageInfo($image_path){ | |
list($width, $height, $type, $attr) = getimagesize($image_path); | |
$image_type = ''; |
OlderNewer