Skip to content

Instantly share code, notes, and snippets.

View keichan34's full-sized avatar
👋
Hello!

Keitaroh Kobayashi keichan34

👋
Hello!
View GitHub Profile
<?php
header("Content-Type: application/rss+xml");
date_default_timezone_set("Asia/Tokyo");
function formatTime($duration) //as hh:mm:ss
{
$hours = floor($duration / 3600);
$minutes = floor( ($duration - ($hours * 3600)) / 60);
$seconds = $duration - ($hours * 3600) - ($minutes * 60);
defmodule SimpleHelloWorld do
import Plug.Conn, only: [resp: 3, halt: 1]
def init(_), do: nil
def call(%{request_path: request_path} = conn, _) when request_path == "/" do
conn
|> resp(200, "Hello, world!")
|> halt
end
#!/usr/bin/env ruby
require 'benchmark'
Benchmark.bmbm do |x|
x.report("Push x2") do
ary = []
100000.times do
ary << 'hi'
ary << 'hihi'
~/Desktop > ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
~/Desktop > ruby ./concat_benchmark.rb
Calculating -------------------------------------
Interpolation 81.309k i/100ms
Array + join 65.714k i/100ms
String concatenation 62.816k i/100ms
String mutation 68.529k i/100ms
-------------------------------------------------