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
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
import Control.Applicative | |
import Data.Char | |
import Data.List (intersperse) | |
import Data.Monoid hiding (All, Any) | |
import Data.Foldable hiding (all, any) | |
import Prelude hiding (all, any) |
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
{-# LANGUAGE GeneralizedNewtypeDeriving #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Applicative | |
import Control.Monad.Except | |
import Control.Monad.IO.Class () | |
import Control.Monad.Reader |
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
/* | |
Version: 3.4.5 Timestamp: Mon Nov 4 08:22:42 PST 2013 | |
*/ | |
.select2-container { | |
margin: 0 0 1rem 0; | |
position: relative; | |
vertical-align: middle; | |
font-family: inherit; | |
-webkit-appearance: none !important; | |
font-size: 0.875rem; |
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' | |
require 'delegate' | |
require 'forwardable' | |
class Person | |
def initialize(name) | |
@name = name | |
end | |
def name |
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
gem 'rails-api' | |
gem 'active_model_serializers' | |
gem_group :development, :test do | |
gem 'debugger' | |
gem 'rspec-rails' | |
gem 'shoulda-matchers' | |
gem 'factory_girl_rails' | |
end |
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
SSH agent forwarding is great. It allows you to ssh from one server to | |
another all the while using the ssh-agent running on your local | |
workstation. The benefit is you don't need to generate ssh key pairs | |
on the servers you are connecting to in order to hop around. | |
When you ssh to a remote machine the remote machine talks to your | |
local ssh-agent through the socket referenced by the SSH_AUTH_SOCK | |
environment variable. | |
So you the remote server you can do something like: |
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
class ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick | |
storage :file | |
def thumb(size) | |
begun_at = Time.now | |
size.gsub!(/#/, '!') | |
uploader = Class.new(self.class) | |
uploader.versions.clear | |
uploader.version_names = [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
import sublime, sublime_plugin | |
import os | |
class DetectFileTypeCommand(sublime_plugin.EventListener): | |
""" Detects current file type if the file's extension isn't conclusive """ | |
""" Modified for Ruby on Rails and Sublime Text 2 """ | |
""" Original pastie here: http://pastie.org/private/kz8gtts0cjcvkec0d4quqa """ | |
def on_load(self, view): | |
filename = view.file_name() |
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
# This is the root of our app | |
@root = File.expand_path(File.join(File.dirname(__FILE__), "www")) | |
run Proc.new { |env| | |
# Extract the requested path from the request | |
req = Rack::Request.new(env) | |
index_file = File.join(@root, req.path_info, "index.html") | |
if File.exists?(index_file) | |
# Rewrite to index |
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 | |
# encoding: UTF-8 | |
# | |
# LearnRubyByExample: | |
# | |
# Ruby is a highly expressive programming language. | |
# Testing software is an expressive way to communicate how it works. | |
# | |
# In the middle of a night awake for allergy and insomnia, and some days after the 1st _why day, | |
# I've tried to combine Ruby and testing to help teaching ruby with some goals in mind: |
NewerOlder