Try these rules:
(in www.domain.com's server block)
rewrite ^/$ http://domain.com permanent break;
rewrite ^/main(.*)$ http://domain.com$1 permanent break;
defmodule ExTwilio.ResultStream do | |
@moduledoc """ | |
Generate a stream of results for a given Twilio API URL. Pages are lazily | |
loaded on demand. | |
## Example | |
ExTwilio.ResultStream.new(ExTwilio.Call) | |
|> Stream.map(fn call -> call.sid end) | |
|> Enum.take(5) |
Try these rules:
(in www.domain.com's server block)
rewrite ^/$ http://domain.com permanent break;
rewrite ^/main(.*)$ http://domain.com$1 permanent break;
#!/usr/bin/env python | |
""" | |
Modified from | |
http://macscripter.net/viewtopic.php?id=26675 | |
http://apple.stackexchange.com/questions/90040/look-up-a-word-in-dictionary-app-in-terminal | |
HowTo |
// To optimize, minify and combine svg files | |
// | |
// Example: | |
// grunt --target="../app/views/public/shared/_svg.html" | |
// grunt --target="../app/views/public/shared/_categories_svg.html" --source="categories/*.svg" | |
// | |
module.exports = function(grunt) { | |
// process argv | |
var target = grunt.option('target') || '../app/views/public/shared/_svg.html'; |
http { | |
... | |
proxy_cache_path /data/perch.squaremill.com/shared/image_cache levels=1:2 keys_zone=images:10m; | |
... | |
} |
# run from the root: ruby find_missing_indices.rb | |
require File.expand_path("../config/environment", __FILE__) | |
Rails.application.eager_load! | |
models = ActiveRecord::Base.descendants | |
conn = ActiveRecord::Base.connection | |
missing_index = [] | |
models.each do |model| |
# required: Rails 5 or active_model-errors_details gem | |
# see: https://cowbell-labs.com/2015-01-22-active-model-errors-details.html | |
module CheckValidationDetails | |
# Check if the given error exists on given attribute | |
# | |
# @param attribute [Symbol] model attribute | |
# @param error [Symbol] machine-friendly error name | |
# @return [Boolean] whether or not any given error exists | |
def error?(attribute, error) | |
errors.details.key?(attribute) && errors.details[attribute].any? { |err| err[:error] == error } |
#!/bin/sh | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Set the colours you can use | |
black='\033[0;30m' | |
white='\033[0;37m' | |
red='\033[0;31m' |
brands = [] | |
brand = Brand.new | |
brand.name = "Harry's" | |
brand.remote_logo_url = "http://example.com/image.png" # store file in cache and give it an ID | |
brand.logo_attacher.store! # force refile to fill logo_id attribute without .save | |
brands << brand | |
# Bulk import all of the brands at once. NO CALLBACKS! |