go build -buildmode=c-shared -o sum.so sum.go
ruby link.rb
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
Windows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout] | |
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,1d,00,3a,00,00,00,00,00 |
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 | |
-- This table contains all the distinct date | |
-- instances in the data set | |
dates(date) AS ( | |
SELECT DISTINCT CAST(CreationDate AS DATE) | |
FROM Posts | |
WHERE OwnerUserId = ##UserId## | |
), | |
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
# Full list of Russian Federation time zones with helper to get this list. | |
# Place this file in config/initializers/timezones.ru.rb | |
class ActiveSupport::TimeZone | |
@country_zones = ThreadSafe::Cache.new | |
def self.country_zones(country_code) | |
code = country_code.to_s.upcase | |
@country_zones[code] ||= | |
TZInfo::Country.get(code).zone_identifiers.select do |tz_id| |
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 'active_record' | |
require 'open-uri' | |
require 'pg' | |
require 'minitest/autorun' | |
ActiveRecord::Base.establish_connection( | |
adapter: 'postgresql', | |
database: 'trgm', | |
host: 'localhost', | |
username: 'postgres' |
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
directive('dateBinding', function() { | |
//var format = "YYYY-MM-DD HH:mm:ss" | |
//date.isValid() is not enough for strict validation, see moment.js doc | |
//var pattern = /^\s*\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}(:\d{2})?\s*$/ | |
var parseFormat = attrs.dateBinding; | |
return { | |
restrict: 'A', | |
require: 'ngModel', | |
link: function(scope, element, attr, ngModel) { | |
ngModel.$parsers.push(function(text) { |
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
http://www.postgresql.org/docs/devel/static/rangetypes.html | |
create_table :Room do |t| | |
t.daterange :availability | |
end | |
Room.create(availability: (Date.today..Float::INFINITY)) | |
Room.first.availability # => Wed, 19 Sep 2012..Infinity | |
connection.execute(%q{ |
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" | |
"io" | |
"io/ioutil" | |
"net" | |
"os" | |
"strings" |
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
// ---- | |
// libsass (v3.2.4) | |
// ---- | |
/// Horizontal, vertical or absolute centering | |
/// If specified, this mixin will use negative margins | |
/// based on element's dimensions. Else, it will rely | |
/// on CSS transforms which have a lesser browser support | |
/// but are more flexible as they don't require to set | |
/// any specific dimensions to the element. |
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
# http://www.evanmiller.org/bayesian-ab-testing.html implemented in ruby | |
# requires the distribution gem from https://github.com/clbustos/distribution (gem 'distribution', require: false) | |
def probability_b_beats_a(completed_a, total_a, completed_b, total_b) | |
require 'distribution/math_extension' | |
total = 0.0 | |
alpha_a = completed_a + 1 | |
beta_a = total_a - completed_a + 1 | |
alpha_b = completed_b + 1 |