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
# Basic regex + Ruby method to strip textile formatting. | |
# Handles all test cases at http://hobix.com/textile/ down to "Phrase Attributes." | |
def strip_textile(text) | |
text.gsub(/\b[_+^*~@%\-]{1,2}|[_+^*~@%\-]{1,2}\b|\b\?\?|\?\?\b|h\d\.\s|bq.\s|fn\d\.\s|\D\{.*\}\.\s?|\{.*\}\.\s?|\%\{.*\}|\D\(.*\)\.\s?|\{%.*\%\}\s|<.*?>/, "") | |
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
// | |
// UIImageView+imageFrame.swift | |
// Tindex | |
// | |
// Created by Koen Punt on 24-08-15. | |
// Copyright (c) 2015 Koen Punt. All rights reserved. | |
// | |
import UIKit |
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 'active_support/inflector' | |
guard 'rspec', :version => 2 do | |
# ... | |
# entries auto-generated after running "guard init rspec" | |
# ... | |
watch(%r{^spec/factories/(.+)\.rb$}) do |m| | |
%W[ | |
spec/models/#{m[1].singularize}_spec.rb | |
spec/controllers/#{m[1]}_controller_spec.rb |
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
var fs = require('fs'), // file system access | |
path = require('path'), | |
less = require('less'); // less processor | |
var options = { | |
compress: true, | |
optimization: 1, | |
silent: false | |
}; |
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
# /etc/monit/monitrc (excerpt) | |
check process node-app with pidfile /var/run/node-app.pid | |
start program = "/sbin/start node-app" with timeout 5 seconds | |
stop program = "/sbin/stop node-app" | |
if failed port 3000 protocol HTTP | |
request / | |
with timeout 3 seconds | |
then restart | |
if cpu > 80% for 10 cycles then restart |
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
module ActiveRecord::ConnectionAdapters | |
class Mysql2Adapter | |
alias_method :execute_without_retry, :execute | |
def execute(*args) | |
execute_without_retry(*args) | |
rescue Mysql2::Error => e | |
if e.message =~ /server has gone away/i | |
warn "Server timed out, retrying" | |
reconnect! |
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
# | |
# zsh function to start Foreman based on whether or not | |
# you have multiple Procfiles | |
# | |
# we are adopting this schema of having environment | |
# specific Procfiles: | |
# | |
# config/development.proc | |
# config/stage.proc | |
# config/production.proc |
TextMate by default will highlight anything in a <script>
tag as javascript.
But for Backbone.js and other javascript MVC frameworks, the script tag is used as a template container.
So this will remove javascript highlighting and use html highlighting instead for any <script type="text/template">
tag.
Replace this line in the Bundle Editor for HTML language:
begin = '(?:^\s+)?(<)((?i:script))\b(?![^>]*/>)';
with this line:
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
# Gets the basename of the original request | |
map $request_uri $request_basename { | |
~/(?<captured_request_basename>[^/?]*)(?:\?|$) $captured_request_basename; | |
} | |
# Gets the basename of the current uri | |
map $uri $basename { | |
~/(?<captured_basename>[^/]*)$ $captured_basename; | |
} |
OlderNewer