This file contains hidden or 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
============================================ | |
I have kicked myself mentally a hundred times for that stupidity and don't think I'll ever really, finally get | |
over it. Evidently what I saw sloshing around was gas in the reserve tank which I had never turned on. I didn't | |
check it carefully because I assumed the rain had caused the engine failure. I didn't understand then how foolish | |
quick assumptions like that are. Now we are on a twenty-eight-horse machine and I take the maintenance of it very | |
seriously. | |
============================================ | |
I found the cause of the seizures a few weeks later, waiting to happen again. It was a little twenty-five-cent | |
pin in the internal oil-delivery system that had been sheared and was preventing oil from reaching the head at | |
high speeds. |
This file contains hidden or 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
# -*- coding: utf-8 -*- | |
require 'rubygems' | |
require 'capybara' | |
require 'capybara/dsl' | |
Capybara.run_server = false | |
Capybara.default_driver = :selenium | |
Capybara.app_host = 'http://iknow.jp' | |
This file contains hidden or 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
module SafeConstDefinition | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def const_missing(name) | |
puts "Warning: #{name} was not defined, assuming further definition. Keep calm tho." | |
# Since Parent is defined after Child both in root and in SomeModule, | |
# i need to have a mechanism to define a future const, but simple: |
This file contains hidden or 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/sh | |
PATH=/bin:/usr/bin:/sbin:/usr/sbin | |
DAEMON=/a/my-app/current/run.sh | |
PIDDIR=/a/my-app/current/tmp/pids | |
PIDFILE="$PIDDIR/my-app.pid" | |
USER="myuser" | |
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" |
This file contains hidden or 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
(defn wrap-fn | |
"Wrap or replace some function with your own function" | |
[qualifier wrapper] | |
(alter-var-root | |
qualifier | |
(fn [original-fn] | |
(fn [& caller-arguments] | |
(wrapper caller-arguments original-fn))))) | |
;; Replace your function implementation: |
This file contains hidden or 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
HOST = # masked | |
SOURCE_PORT = 5672 | |
DESTINATION_PORT = 5672 | |
USERNAME = ifesdjeen | |
createTunnel() { | |
/usr/bin/ssh -f -N -L$SOURCE_PORT:$HOST:$DESTINATION_PORT -L19922:HOST:22 ifesdjeen@$HOST | |
if [[ $? -eq 0 ]]; then | |
echo Tunnel to $HOST created successfully | |
else |
This file contains hidden or 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
;; That will actually catch exception within inner thread, too. And within inner thread of inner thread. Etc. | |
(Thread/setDefaultUncaughtExceptionHandler (proxy [Thread$UncaughtExceptionHandler] [] | |
(uncaughtException [t e] | |
;; | |
;; Your fancy Exception logging here | |
;; | |
(println "Throwable: " + (.getMessage e)) | |
(println (.toString t))))) | |
(.start (Thread. (cast Runnable | |
(fn [] |
This file contains hidden or 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
# Returns value from hash based on the path | |
# | |
# @param hash [Hash] - hash to retrieve values from | |
# @param path [Array] - non-empty array representing recursive path | |
# | |
# @returns [Object] - an object located within an array on the given path | |
# | |
# Examples: | |
# | |
# get_in({:a => {:b => {:c => 2}}}, [:a, :b, :c]) # => 2 |
This file contains hidden or 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
(ns clojurewerkz.cassaforte.thrift.column | |
(:use [clojurewerkz.support.string :only [to-byte-buffer]] | |
[clojurewerkz.cassaforte.bytes :only [encode]]) | |
(:import [org.apache.cassandra.thrift Column])) | |
(defn ^Column build-column | |
"Converts clojure map to column" | |
([^String key ^String value] | |
(build-column to-byte-buffer key value (System/currentTimeMillis))) |
This file contains hidden or 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
;; | |
;; Leaving defaccumulator/defcompound details aside, when you see following lines, is it clear what's going on? | |
;; Or is it easier to read a straightforward loop, without dispatcher-based magic? | |
;; | |
;; As for me, advantage is that rules are completely decouple from each other. It's very easy to understand and | |
;; debug parts of the processing, rather than try to figure out how the complete algorithm works at once. | |
;; When reading algorithm description, you see clear definition of steps and rules, although when you see | |
;; the implementation it's all combined into one humongous function, that's doing everything, and dispatch rules | |
;; are wowed, which makes it even more complex. | |
;; |
OlderNewer