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 "./src/send" | |
struct Template | |
getter body : String | |
def initialize(@body) | |
end | |
def transform(data) | |
@body.gsub(/(###([_\w]+)###)/) do |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
# String Subclass For Reading Files. | |
class FString < String | |
# Set a filename to read | |
def from(fn) | |
@io = IO.new(IO.sysopen(fn)) | |
end | |
# Reads the file set in #from, one line at a time, yielding each line. This results in an empty FString when finished. | |
def feach(&blk) | |
self << @io.sysread(512) until self.include?($/) |
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 'benchmark/ips' | |
class Lcs | |
def initialize(s1, s2) | |
@s1 = s1 | |
@s2 = s2 | |
end | |
def calculate | |
if @s1.size < @s2.size |
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 "benchmark" | |
class Lcs | |
def initialize(@s1 : String, @s2 : String); end | |
def calculate | |
if @s1.size < @s2.size | |
source = @s1 | |
compare = @s2 | |
else |
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
import React, { useState, useEffect } from 'react' | |
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' | |
import { | |
Grid, | |
Card, | |
CardContent, | |
Button, | |
Divider | |
} from '@material-ui/core' |
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
# frozen_string_literal: true | |
module Lita | |
module Handlers | |
module Wyh | |
# This implements a router that allows for more intelligence and sophistication | |
# than simple regex routing. | |
class EventRouter < Handler | |
on :unhandled_message, :event_route |
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 | |
# frozen_string_literal: true | |
require 'erb' | |
require 'json' | |
require 'shellwords' | |
# This is a small utility to run ALTER TABLE statements via pt-osc while | |
# sending all other SQL statements to MySQL. | |
# rubocop: disable Metrics/ClassLength |
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
#!/bin/bash | |
ROOT="/path/to/deploy/to" | |
mkdir -p "${ROOT}" | |
BRANCH="master" | |
# Add to these hooks anything that you want done before or after the deployment | |
# such as backing up your old deployment, or restarting application containers. | |
BEFORE_HOOK='cd ${ROOT}' | |
AFTER_HOOK='cd ${ROOT}' |
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
To recap, picture a modestly sized server. Running nginx 0.8.54 on the front end, with Passenger 3.0.5 behind it, in front of a Rails app. | |
Said Rails app has some pretty fast actions, so when one pokes it with a burst of, say, 100 concurrent requests, it slams through them in less than half a second. | |
But, when one pokes it harder, with a larger burst (200 concurrent is enough), errors start flying: | |
2011/03/22 06:13:33 [error] 6651#0: *33376 connect() to unix:/passenger_helper_server failed (11: Resource temporarily unavailable) while connecting to upstream.... | |
Is this normal? It surprised me. |
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
On an xcloud slice: | |
# eselect ruby list | |
Available Ruby profiles: | |
[1] ruby18 (with Rubygems) | |
[2] rbx110 (with Rubygems) | |
[3] rbx111 (with Rubygems) | |
[4] jruby155 (with Rubygems) | |
[5] jruby156 (with Rubygems) * |
NewerOlder