Skip to content

Instantly share code, notes, and snippets.

View dotemacs's full-sized avatar

Александар Симић dotemacs

View GitHub Profile
Given /^I visit subdomain "(.+)"$/ do |sub|
#host! "#{sub}.example.com" #for webrat
Capybara.default_host = "#{sub}.example.com" #for Rack::Test
Capybara.app_host = "http://#{sub}.example.com:9887" if Capybara.current_driver == :culerity
################################################################################
# As far as I know, you have to put all the {sub}.example.com entries that you're
# using in your /etc/hosts file for the Culerity tests. This didn't seem to be
# required for Rack::Test
################################################################################
<!-- layout file -->
<% if current_user %>
Welcome <%= current_user.username %>. Not you? <%= link_to "Log out", logout_path %>
<% else %>
<%= link_to "Sign up", signup_path %> or <%= link_to "log in", login_path %>.
<% end %>
@dotemacs
dotemacs / clojure.md
Created April 16, 2012 22:27
Setting Up Clojure on OS X

Setting Up Clojure on OS X

I spent a lot of time trying to find a pretty optimal (for me) setup for Clojure… at the same time I was trying to dive in and learn it. This is never optimal; you shouldn't be fighting the environment while trying to learn something.

I feel like I went through a lot of pain searching Google, StackOverflow, blogs, and other sites for random tidbits of information and instructions.

This is a comprehensive "what I learned and what I ended up doing" that will hopefully be of use to others and act as a journal for myself if I ever have to do it again. I want to be very step-by-step and explain what's happening (and why) at each step.

I appreciate the effort you've put into documenting this, but there are a number of inaccuracies here that need to be addressed. We get

@dotemacs
dotemacs / ip_address_validator.rb
Created September 16, 2012 21:28 — forked from geoffgarside/ip_address_validator.rb
Rails 3.x IP Address validator class
# The IP Address Validator accepts the following options
#
# * allow_nil - allows nil values
# * allow_blank - allows blank values
# * allow_cidr - allows /prefixlen CIDR masks in values
#
# the validator will use regular expressions in an attempt to prevent
# malformed IP addresses from being passed to the IPAddr.new initializer
# as this method can be very slow to raise exceptions for malformed input.
class IpAddressValidator < ActiveModel::EachValidator
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"

Bearded's Hourly Contract

Date: [[Date of Document]] Between [Our Company] and [Your Company]

Summary

We’re not big on formality, but sometimes it’s best to have a few simple things written down so that we’re all on the same page. In this contract you won’t find complicated legal terms or large passages of unreadable text. We have no desire to trick you into signing something that you might later regret. We do want what’s best for the safety of both parties, now and in the future.

@dotemacs
dotemacs / clojurex-2014.org
Created June 30, 2017 21:39 — forked from philandstuff/clojurex-2014.org
Clojure eXchange 2014

Korny Sietsma, Pragmatic Performance Testing

quotes

  • “we don’t care about perf”
  • “clojure should be fast”
  • “we’re using mongo!”
  • “clojure might not be fast enough, we should use type hints”

JMeter

@dotemacs
dotemacs / bp.clj
Created September 3, 2017 22:53 — forked from cgrand/bp.clj
pseudo code for back pressure bridging
(a/go-loop [async-tcp-connections-to-chans ; "foreign" -> ch
buffered ; ch -> data
pressurized] ; ch -> foreign
(let [cnx (select (keys async-tcp-connections-to-chans))
ch (async-tcp-connections-to-chans cnx)
data (read-data cnx)
async-tcp-connections-to-chans (dissoc async-tcp-connections-to-chans cnx)
buffered (assoc buffered ch data)
pressurized (assoc pressurized ch cnx)]
(ns er-model.connectors.kafka.deserializers
(:require
[clojure.edn :as edn])
(:import
[org.apache.kafka.common.serialization
Deserializer
StringDeserializer
LongDeserializer
IntegerDeserializer
ByteArrayDeserializer]
(ns er-model.connectors.kafka.serializers
(:import (org.apache.kafka.common.serialization
LongSerializer
Serializer
IntegerSerializer
StringSerializer
ByteArraySerializer)
(java.io ByteArrayOutputStream)))
;; from https://github.com/ymilky/franzy/blob/master/src/franzy/serialization/serializers.clj