Skip to content

Instantly share code, notes, and snippets.

View victorhazbunanuff's full-sized avatar

victor hazbun anuff victorhazbunanuff

  • koombea
  • barranquilla
View GitHub Profile
@victorhazbunanuff
victorhazbunanuff / das_download.rb
Created June 6, 2012 19:34 — forked from kalbasit/das_download.rb
Script to download all Destroy All Software screencasts, account needed
#! /usr/bin/env ruby
# usage:
# $ das_download.rb email password [download_directory]
require 'mechanize'
# gem 'mechanize-progressbar'
email = ARGV[0] or raise('Please provide the email address for your account')
password = ARGV[1] or raise('Please provide the password for your account')
path = (ARGV[2] || './').gsub /\//,''
@victorhazbunanuff
victorhazbunanuff / peepcode.rb
Created July 11, 2012 03:16 — forked from gertig/peepcode.rb
A script to download all Peepcode screencasts with ruby & wget (supports resume)
require 'mechanize'
@username = 'user@domain.com'
@password = 'hi2u'
@download_path = File.expand_path 'downloads'
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt'
unless File.directory? @download_path
puts "@{download_path} doesn't exist!"
exit
@victorhazbunanuff
victorhazbunanuff / gist:3991453
Created November 1, 2012 03:26 — forked from lucasfais/gist:1207002
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@victorhazbunanuff
victorhazbunanuff / account_spec.rb
Created June 25, 2013 22:13
test for account deletion (model spec)
describe "#destroy_pendings" do
before(:each) do
@account1 = FactoryGirl.create(:account, domain: 'foobar', admin_attributes: valid_user, plan: FactoryGirl.create(:subscription_plan, :basic))
@account2 = FactoryGirl.create(:account, domain: 'foobars', admin_attributes: valid_user, plan: FactoryGirl.create(:subscription_plan, :basic))
@account1.delayed_deletion
end
context "when there are no accounts to be permanent deleted" do
it "should not delete any account" do
expect {
def delayed_deletion
begin
Account.transaction do
update_column(:deleted_at, Date.current)
destroy_subscription
end
rescue Exception; end;
AccountAlertMailer.deletion_notification(admin).deliver
end
require_relative '../../app/services/recurly_account_checker'
require 'recurly'
describe RecurlyAccountChecker do
let(:user) { stub }
let(:customer) { stub }
let(:customer_id) { -1 }
before do
user.stub(:customer_id) { customer_id }
Recurly::Account.stub(:find) { customer }
end
class AccountDeletionJob
@queue = :account_deletion
# Warning .perform will destroy an account from the database.
def self.perform(account_id)
account = Account.find(account_id)
if account
Account.transaction do
begin
account.destroy!
AccountAlertMailer.deletion_notification(account).deliver
@victorhazbunanuff
victorhazbunanuff / global.js
Last active December 20, 2015 19:49
Copy and reflect values from an element to another
function ReflectValueOnKeyUp(from, to, options) {
var options = options || {};
var escape_string = options.escape_string || false;
$(from).keyup(function(){
var that = $(this);
if (options.escape_string == true) {
$(to).val(escapeString(that.val()));
} else {
$(to).val(that.val());
}
// While you can edit this file, it's best to put your changes in
// "User/Preferences.sublime-settings", which overrides the settings in here.
//
// Settings may also be placed in file type specific options files, for
// example, in Packages/Python/Python.sublime-settings for python files.
{
// Sets the colors used within the text area
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
// Note that the font_face and font_size are overriden in the platform
@victorhazbunanuff
victorhazbunanuff / solution
Created August 20, 2013 15:51
command not found: mailcatcher
1. Open ~/.bash_profile
2. copy and paste LC_CTYPE="utf-8"
3. Execute mailcatcher