This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
| require 'benchmark' | |
| count = 1000000 | |
| Benchmark.benchmark do |bm| | |
| bm.report("concat") { count.times { 11.to_s + '/' + 12.to_s } } | |
| bm.report("interp") { count.times { "#{11}/#{12}" } } | |
| end |
| var Arch; if (!Arch) Arch = {}; // set up custom namespace 'arch' | |
| Arch.Flash = { | |
| showError: function(message) { | |
| if (message == "") return; | |
| $('#flash-msg .user-msg-detail').removeClass('notice'); | |
| $('#flash-msg .user-msg-detail').addClass('error'); | |
| $('#flash-msg .user-msg-detail span').html(message); | |
| $('#flash-msg').show(); | |
| }, |
| This playbook has been removed as it is now very outdated. |
| class UrlValidator < ActiveModel::EachValidator | |
| def validate_each(record, attribute, value) | |
| valid = begin | |
| URI.parse(value).kind_of?(URI::HTTP) | |
| rescue URI::InvalidURIError | |
| false | |
| end | |
| unless valid | |
| record.errors[attribute] << (options[:message] || "is an invalid URL") |
| #/bin/bash | |
| #-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password | |
| REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'` | |
| if [ -z "$REPO_URL" ]; then | |
| echo "-- ERROR: Could not identify Repo url." | |
| echo " It is possible this repo is already using SSH instead of HTTPS." | |
| exit | |
| fi |
| class AvatarUploader < CarrierWave::Uploader::Base | |
| # include CarrierWave::RMagick | |
| # configure do |config| | |
| # config.remove_previously_stored_files_after_update = false | |
| # end | |
| include Cloudinary::CarrierWave | |
| process :convert => 'jpg' #converts all images to pngs |
This helper has finally been moved into a gem called nav_lynx!
https://github.com/vigetlabs/nav_lynx
http://rubygems.org/gems/nav_lynx
Thanks to @brianjlandau and @reagent for getting that set up and tested!
| # SSL self signed localhost for rails start to finish, no red warnings. | |
| # 1) Create your private key (any password will do, we remove it below) | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
| #!/usr/lib/env ruby | |
| # Acquires a shared lock on a SQLite database file and copies it to a backup | |
| # usage: backup-db.rb DBFILE.db BACKUPFILE.db | |
| # author: William Benton ([email protected]) | |
| # Public domain. | |
| require 'sqlite3' | |
| require 'fileutils' |
| module Foo | |
| def bar | |
| "A cow" | |
| end | |
| end | |
| describe Foo | |
| let :subject_class { Class.new } | |
| let :subject { subject_class.new } |