Skip to content

Instantly share code, notes, and snippets.

View mariusbutuc's full-sized avatar
🌏

Marius Butuc mariusbutuc

🌏
  • Toronto, ON
  • 02:27 (UTC -04:00)
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>20113 - Campaign not found</faultstring>
<detail>
<ns1:serviceException xmlns:ns1="http://www.marketo.com/mktows/">
<name>mktServiceException</name>
<message>Request campaign needs to have a 'Campaign Requested' trigger and needs to be activeted, cannot request forMarketyProgram (20113)</message>
@mariusbutuc
mariusbutuc / com.googlecode.iterm2.plist
Created July 21, 2014 20:48
A Solarize colour scheme for iTerm2 where 'green' is actually green
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>AdjustWindowForFontSizeChange</key>
<true/>
<key>AllowClipboardAccess</key>
<false/>
<key>AnimateDimming</key>
<false/>
require 'digest'
# Get SHA256 Hash of a file
puts Digest::SHA256.hexdigest File.read "data.dat"
# Get MD5 Hash of a file
puts Digest::MD5.hexdigest File.read "data.dat"
# Get MD5 Hash of a string
puts Digest::SHA256.hexdigest "Hello World"
# Get SHA256 Hash of a string using update
@mariusbutuc
mariusbutuc / pg_install.bash
Last active August 29, 2015 14:04
pg gem installation requirements to work in conjunction w/ Postgres.app
# check here for context: http://stackoverflow.com/a/24897553/341929
env ARCHFLAGS="-arch x86_64" gem install pg -- \
--with-pg-config=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
@mariusbutuc
mariusbutuc / git_rename_branch.sh
Last active August 29, 2015 14:17 — forked from stuart11n/gist:9628955
Rename git branch—both locally and upstream.
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@mariusbutuc
mariusbutuc / pg_upgrade.sh
Last active August 29, 2015 14:17 — forked from joho/gist:3735740
PostgreSQL 9.3 to 9.4.1 upgrade steps
# Steps to install and run PostgreSQL 9.4.1 using Homebrew (Mac OS X)
# (if you aren't using version 9.3, change line #9 with the correct version)
launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
mv /usr/local/var/postgres /usr/local/var/postgres93
brew update
brew upgrade postgresql
initdb /usr/local/var/postgres -E utf8
pg_upgrade -b /usr/local/Cellar/postgresql/9.3/bin -B /usr/local/Cellar/postgresql/9.4.1/bin -d /usr/local/var/postgres93 -D /usr/local/var/postgres
cp /usr/local/Cellar/postgresql/9.4.1/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/
@mariusbutuc
mariusbutuc / simple_form_bootstrap.sh
Created April 3, 2015 16:49
Install simple_form with Bootstrap support (SLIM version)
clubhouse marius$ rails generate simple_form:install --bootstrap
create config/initializers/simple_form.rb
create config/initializers/simple_form_bootstrap.rb
exist config/locales
create config/locales/simple_form.en.yml
create lib/templates/slim/scaffold/_form.html.slim
===============================================================================
Be sure to have a copy of the Bootstrap stylesheet available on your
application, you can get it on http://getbootstrap.com/.
class CorreiosRequest
# ...
def build_params(package)
@params.merge(package.params)
end
def hash_query_string(params)
{
'nCdEmpresa' => params[:company_id],
'sDsSenha' => params[:password],
#!/usr/bin/env ruby
require 'csv'
require 'json'
if ARGV.size != 2
puts 'Usage: csv_to_json input_file.csv output_file.json'
puts 'This script uses the first line of the csv file as the keys for the JSON properties of the objects'
exit(1)
end
CSV_FILENAME = 'config/items.csv'.freeze
YML_FILENAME = 'config/items.yml'.freeze
File.open(YML_FILENAME, 'w') do |f|
f.puts(CSV.table(CSV_FILENAME).map(&:to_hash).to_yaml)
end
YAML.load(File.new(YML_FILENAME))