This file contains hidden or 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
#!/bin/bash | |
filetype=$(file -b --mime-type "$1") | |
if [[ "$(uname)" == "Darwin" ]]; then # MacOS | |
# Check if ImageMagick is installed | |
if ! command -v identify >/dev/null 2>&1; then | |
echo "ImageMagick is not installed. Installing..." | |
brew install imagemagick | |
fi |
This file contains hidden or 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
# test helpers for integration testing written by David Lowenfels | |
# place in lib/internaut/shoulda_extensions.rb | |
require "rails-dom-testing" # for css_select method | |
## Example usage | |
module Internaut | |
module ShouldaExtensions | |
extend ActiveSupport::Concern |
This file contains hidden or 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
# This script requires the nokogiri gem, and youtube-dl to be installed. | |
# It will fetch video, mp3, and text results. | |
# download cookies.txt using Chrome plugin "Get cookies.txt" | |
# download page source as course-page.html | |
quality = "iphone-360p" # to find quality options, use youtube-dl -v -F --cookies cookies.txt https://{KAJABI_COURSE}/categories/#####/posts/##### | |
cookies = "=cookies.txt" | |
course_url = "https://www.MYCOURSE.COM" | |
domain = course_url.split("/")[2] |
This file contains hidden or 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 'yaml' | |
require 'fileutils' | |
namespace :db do | |
desc "create the db/backup directory if it doesn't exist" | |
task :create_backup_dir do | |
FileUtils.mkdir_p backup_dir | |
end |
This file contains hidden or 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
# mysql db backup and restore for rails | |
# by David Lowenfels <[email protected]> 4/2011 | |
require 'yaml' | |
namespace :db do | |
def backup_prep | |
@directory = File.join(RAILS_ROOT, 'db', 'backup') | |
@db = YAML::load( File.open( File.join(RAILS_ROOT, 'config', 'database.yml') ) )[ RAILS_ENV ] | |
@db_params = "-u #{@db['username']} #{@db['database']}" |
This file contains hidden or 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 'digest/sha1' | |
module FactoriesAndWorkers | |
module Factory | |
def self.included( base ) | |
def factory( kind, default_attrs, opts={}, &block ) | |
FactoryBuilder.new( kind, default_attrs, opts, self, &block ) | |
end |
This file contains hidden or 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 Internaut | |
module ActiveRecord | |
module CallbackExtensions | |
def self.included(base) #:nodoc: | |
base.extend ClassMethods | |
base.class_eval do | |
class_inheritable_accessor :disabled_callbacks | |
self.disabled_callbacks = [] # set default to empty array | |
end |
This file contains hidden or 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
# example unit test context using should_change and should_not_change | |
context "Given a user" do | |
setup do | |
@user = create_user | |
end | |
context "when sent initials with a hyphen and lower case" do | |
setup do | |
@user.update_attributes!( :first_name => "Jason", :last_name => "happy-Klein" ) |