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 com.sun.org.apache.xml.internal.security.utils.Base64 | |
import javax.crypto._ | |
import javax.crypto.spec._ | |
import java.security.spec._ | |
import java.io._ | |
import java.security.{NoSuchAlgorithmException, InvalidAlgorithmParameterException} | |
import javax.management.openmbean.InvalidKeyException | |
import com.sun.org.apache.xml.internal.security.exceptions.Base64DecodingException | |
import play.api.Logger |
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
# https://github.com/mhenrixon/sidekiq-unique-jobs/issues/161 | |
# Even worse: https://github.com/mhenrixon/sidekiq-unique-jobs/issues/234 | |
class SidekiqUniqueJobsHashCompactor | |
include Sidekiq::Worker | |
sidekiq_options queue: "slow" | |
def perform | |
# Skip if there are jobs queued... | |
return unless Sidekiq::Queue.all.select { |q| q.size > 100 }.blank? |
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
tl;dr: | |
$ set -o vi | |
$ bind '"\ee": emacs-editing-mode' | |
Then hit Esc-e | |
$ bind -P| grep edit | |
edit-and-execute-command can be found on "\C-x\C-e". | |
emacs-editing-mode is not bound to any keys | |
vi-editing-mode is not bound to any keys |
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/delayed_job_config.rb | |
# | |
Delayed::Worker.logger = Logger.new(Rails.root.join('log', 'delayed_job.log')) | |
# The base logger is terrible. It only puts what you send. Nothing else. So I had to dig this up and add it. | |
class DJFormatter | |
def call(severity, time, progname, msg) | |
formatted_severity = sprintf("%-5s","#{severity}") | |
"#{Time.now.utc} [#{progname} #{formatted_severity} pid:#{$$}] #{msg.strip}\n" |
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
describe "StaticPages", type: :feature do | |
header_links = [ | |
{ name: 'Sign Up', link: '/signup', text: 'Contacts associated with purchases' }, | |
{ name: 'Log In', link: '/login', text: 'Forgot your user name or password?' } | |
] | |
footer_links = [ | |
{ name: 'Home', link: '/', text: 'Easily and efficiently track'}, | |
{ name: 'Plans & Pricing', link: '/plan', text: 'Standard Features'}, |
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
// NewNotBlankValidator - given field must be declared as a null.* type. This checks to make sure the | |
// field value is its zero or null, or filled in but NOT set to empty String | |
// e.g. {value="", err=false} is not valid. | |
func NewNotBlankValidator(db *gorm.DB) validator.Func { | |
return func(v *validator.Validate, topStruct reflect.Value, currentStruct reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { | |
switch fieldKind { | |
case reflect.String: | |
if field.String() == "" && field.IsValid() { | |
return 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
# | |
# Check: http://redis-rb.keyvalue.org/v2.2.0/ | |
# | |
if Redis_connect | |
case Rails.env | |
when "production" | |
opts = {:host => "YOUR HOST NAME OR IP", :port => "6379", :thread_safe => true } | |
when "staging" | |
opts = {:host => "YOUR HOST NAME OR IP", :port => "6379", :thread_safe => true } | |
else |
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
# god upstart service | |
description "God process monitoring" | |
# When to start and stop the service | |
start on runlevel [2345] | |
stop on runlevel [016] | |
# Automatically restart process if crashed | |
kill timeout 20 | |
respawn |
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
# Apache Basic Authentication for A Rewrite Condition not a Directory | |
# | |
# NOTE: Locations work off of URLs not directories | |
# | |
# Put this in your virtualhost block | |
# | |
<Location /YOUR_URL_PATH/> | |
AuthType Basic | |
AuthName "Authorization Required." | |
AuthUserFile /etc/httpd/conf/htpasswd |
NewerOlder