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 | |
require 'concurrent' | |
require 'coverage' | |
require 'parallel' | |
require 'rspec/core' | |
# serializable notifications inter processes | |
class FailedExampleNotification |
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 "pg" | |
DB.open "postgres://postgres:postgres@localhost:5432/blog_development" do |db| | |
db.transaction do |tx| | |
conn = tx.connection | |
pp conn.scalar "select count(*) from articles" # => 5 | |
pp conn.exec "insert into articles (title, url, markdown, created_at, updated_at) values ('title', 'url', 'markdown', now(), now())" | |
pp db.scalar "select count(*) from articles" # => 5 (because this established another connection) | |
pp conn.scalar "select count(*) from articles" # => 6 |
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
Unhandled exception: (Time::Location::InvalidTZDataError) | |
from /usr/local/Cellar/crystal/0.27.0/src/time/location/loader.cr:86:5 in 'read_zoneinfo' | |
from /usr/local/Cellar/crystal/0.27.0/src/crystal/system/unix/time.cr:59:9 in 'load_localtime' | |
from /usr/local/Cellar/crystal/0.27.0/src/time/location.cr:339:10 in 'load_local' | |
from /usr/local/Cellar/crystal/0.27.0/src/time/location.cr:320:38 in 'local' | |
from /usr/local/Cellar/crystal/0.27.0/src/time.cr:367:16 in 'now' | |
from lib/amber/src/amber/server/server.cr:55:14 in 'start' | |
from lib/amber/src/amber/server/server.cr:50:9 in 'run' | |
from lib/amber/src/amber/server/server.cr:17:7 in 'start' | |
from src/blogway.cr:3:1 in '__crystal_main' |
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
# spec/models/cat_spec.rb | |
require 'rails_helper.rb' | |
RSpec.describe Cat, type: :model do | |
# this is a test target model | |
let(:cat) { Cat.new(status: status) } | |
# this block describes Cat#nyan instance method | |
# when you reference an instance method, write `Class#method` | |
# and for a class method, write 'Class.method' |
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
# Dockerfile | |
------------------ | |
FROM library/ubuntu:16.04 | |
RUN apt-get -y update && apt-get install -y build-essential git python libssl-dev curl | |
# install nodebrew, node | |
ENV NODEBREW_ROOT=/usr/local/nodebrew | |
ENV PATH=/usr/local/nodebrew/current/bin:$PATH | |
RUN export NODE_VERSION=v4.3.2 && curl -L git.io/nodebrew | perl - setup \ | |
&& nodebrew install-binary $NODE_VERSION \ |
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
mkdir mydockerbuild | |
cd mydockerbuild | |
vi Dockerfile | |
FROM library/ubuntu:16.04 | |
RUN apt-get -y update && apt-get install -y build-essential git silversearcher-ag python libssl-dev | |
CMD date | |
docker build -t echo-date . | |
docker images |
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 | |
# http://www.unicode.org/charts/PDF/U1E00.pdf | |
$targets = [ | |
'aắằặấầẩậẳẵạàáâãảăẫ', | |
'eẽẹếềểễệèéêẻ', | |
'oốồổỗộờởơớỡòóôõỏọợ', | |
'iịìíĩỉ', | |
'uứừửưữựụùúũủ', | |
'yỳỷỹỵý' |
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
upstream backend { | |
server unix:/home/vagrant/prj/blog/tmp/sockets/puma.sock; | |
} | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
root /home/vagrant/prj/blog/public; | |
index index.html; |
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
upstream backend { | |
server 127.0.0.1:3001; | |
} | |
# http://henteco-labs.com/labs/2014/04/14/rails-nginx/ | |
server { | |
location / { | |
try_files $uri @proxy; | |
} |
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
def changed(file_path) | |
notify File.open(file_path, "rb").read | |
end | |
def notify(result) | |
messages = result.split("\n") | |
title = messages.shift | |
group = messages.shift | |
info = messages.join("\n") |
NewerOlder