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
rubocop app/models/pressroom.rb | |
== app/models/pressroom.rb == | |
C: 1: Missing encoding comment. | |
C: 26: Ruby 1.8 hash syntax detected | |
C: 26: Ruby 1.8 hash syntax detected | |
C: 27: Ruby 1.8 hash syntax detected | |
C: 27: Ruby 1.8 hash syntax detected | |
C: 40: Ruby 1.8 hash syntax detected | |
C: 42: Ruby 1.8 hash syntax detected | |
C: 42: Line is too long. [90/79] |
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
# We get up to 5 jobs from the db. In case we cannot get exclusive access to a job we try the next. | |
# this leads to a more even distribution of jobs across the worker processes | |
find_available(worker.name, 5, max_run_time).detect do |job| | |
job.lock_exclusively!(max_run_time, worker.name) | |
end | |
# Find a few candidate jobs to run (in case some immediately get locked by others). | |
def self.find_available(worker_name, limit = 5, max_run_time = Worker.max_run_time) |
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
/admin/file avgRequestsPerSecond: 0.0 | |
/admin/file errors: 0 | |
/admin/file handlerStart: 1362440195926 | |
/admin/file requests: 0 | |
/admin/file timeouts: 0 | |
/admin/file totalTime: 0 | |
/admin/luke avgRequestsPerSecond: 0.0 | |
/admin/luke errors: 0 | |
/admin/luke handlerStart: 1362440195924 | |
/admin/luke requests: 0 |
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
MyView = Backbone.View.extend | |
initialize: -> | |
@model.on('change', @render, @) | |
render: -> | |
@$el.html("whatever...") | |
@ | |
# Somewhere in your backbone-app ... | |
view = new MyView(model: aModel) |
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
# config/routes.rb | |
resources :contacts do | |
resources :labels | |
end | |
# app/controllers/network/labels_controller.rb | |
class Network::LabelsController | |
def 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
(defun copy-current-line-position-to-clipboard () | |
"Copy current line in file to clipboard as '</path/to/file>:<line-number>'" | |
(interactive) | |
(let ((path-with-line-number | |
(concat (buffer-file-name) ":" (number-to-string (line-number-at-pos))))) | |
(x-select-text path-with-line-number) | |
(message (concat path-with-line-number " copied to clipboard")))) | |
(define-key global-map (kbd "M-l") 'copy-current-line-position-to-clipboard) |
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 Sendgrid | |
module Configuration | |
def self.included(klass) | |
klass.extend ClassMethods | |
end | |
def mail(headers = {}, &block) | |
headers['X-SMTPAPI'] = { category: calling_mailer_and_action.join("#") }.to_json | |
super(headers, &block) |
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
<script type="text/javascript" charset="utf-8" id="mnd-script"> | |
(function(){var s=document.createElement("script");s.type="text/javascript";s.async=true;s.src="http://sw.mynewsdesk.com/javascripts/mynewsdesk_hosted_iframe.js";var i=document.getElementsByTagName('script')[0];i.parentNode.insertBefore(s,i);})(); | |
</script> |
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
brew install libxml2 | |
gem uninstall nokogiri | |
gem install nokogiri --version 1.5.0 -- --with-xml2-include=/usr/local/Cellar/libxml2/2.7.8/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.7.8/lib --with-xslt-dir=/usr/local/Cellar/libxslt/1.1.26 |
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
(defun mac-osx-editing-insert-at () | |
"Insert @ at point" | |
(interactive) | |
(insert-char ?@ 1)) | |
(defun mac-osx-editing-insert-curly-left () | |
"Insert { at point" | |
(interactive) | |
(insert-char ?{ 1)) |
NewerOlder