Skip to content

Instantly share code, notes, and snippets.

View pootsbook's full-sized avatar

Philip Poots pootsbook

  • ClubCollect
  • Alphen aan den Rijn, NL
View GitHub Profile
@pootsbook
pootsbook / gist:229d5264390d1849c7e9
Created December 22, 2014 09:28
output of fsck_hfs
Philips-MacBook-Pro:~ pootsbook$ sudo fsck_hfs -r -d /dev/disk1s1
Password:
journal_replay(/dev/disk1s1) returned 0
** /dev/rdisk1s1 (NO WRITE)
Using cacheBlockSize=32K cacheTotalBlock=65536 cacheSize=2097152K.
Executing fsck_hfs (version hfs-226.1.1).
Block 2 is not an MDB or Volume Header
Block 1953525164 is not an MDB or Volume Header
volumeType is 0
0000: eb58 9042 5344 2020 342e 3400 0240 2000 |.X.BSD..4.4.....|
@pootsbook
pootsbook / account_creation.rb
Last active August 29, 2015 14:13
Balanced ACH Account Creation
# gem 'balanced', '1.2.1'
# BalancedPayments API v1.1
# ACH Payments only
# Three parties: marketplace (you), merchant (Balanced::Customer), buyer (Balanced::Customer)
bank_account_href = "" # from balanced.js
bank_account = Balanced::BankAccount.fetch(bank_href)
# it seems a customer requires dob_month, dob_year & address.postal_code in order to be verified
# cf. https://docs.balancedpayments.com/1.1/overview/resources/#customer-identity-verification
@pootsbook
pootsbook / ember-uploader-env
Last active August 29, 2015 14:13
Install environment for ember-uploader
# Install Node.js
# https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager
$ curl -sL https://deb.nodesource.com/setup | sudo bash -
$ sudo apt-get install nodejs
$ npm install -g phantomjs
$ npm install -g bower
$ npm install -g ember-cli
$ npm install
# Solve cache issue "Cannot find module"
@pootsbook
pootsbook / stripe_account.rb
Last active August 29, 2015 14:17
A Hash of the Stripe::Account attributes for Connect managed accounts (26 Mar 15)
stripe_account = {
country: 'US',
display_name: 'string',
email: 'string',
business_name: 'string',
business_url: 'string',
managed: true,
bank_account: 'stripe.js token',
legal_entity: {
address: {
@pootsbook
pootsbook / gist:1583368
Created January 9, 2012 15:18
Ever wanted Array#penultimate? How about Array#penpenultimate
class Array
def method_missing(method_sym, *arguments, &block)
if method_sym.to_s =~ /^((pen)+)ultimate$/
pen_index = 1 + ($1.length/3)
self[-pen_index]
else
super
end
end
end
@pootsbook
pootsbook / isbn.rb
Created July 26, 2012 13:04
Solutions to ISBN cleaning and validation
Paste solutions in the comments below. Don't forget to make it code using GitHub markdown.
@pootsbook
pootsbook / directory_listing.php
Created November 1, 2012 17:57
PHP -> Ruby: Listing Directory
// Removed the HTML for readability
<?php
$Directory = opendir("../");
while($entryName = readdir($Directory)) {
$dirArray[] = $entryName;
}
closedir($Directory);
@pootsbook
pootsbook / tilt.rb
Created November 3, 2012 18:48
Iterate through an array while rescuing exceptions
# https://github.com/rtomayko/tilt/blob/master/lib/tilt.rb
# Try each of the classes until one succeeds. If all of them fails,
# we'll raise the error of the first class.
first_failure = nil
klasses.each do |klass|
begin
klass.new { '' }
rescue Exception => ex
@pootsbook
pootsbook / emberwatch_ordering.txt
Created November 24, 2012 19:31
Ordering of Links on EmberWatch as of November 2012
Hey Tom (and others),
At the moment ordering of links on EmberWatch is strictly
chronological, and for the different content types chronological is
defined thus:
- Talks: date of delivery
(when the talk was given, not when it was posted online)
- Tutorials, Screencasts: date of publication
@pootsbook
pootsbook / habtm_not_null.php
Created December 2, 2012 20:21
Ignore records with no attached records
$options['joins'] = array(
array('table' => 'images_news_articles',
'alias' => 'ImagesNewsArticle',
'type' => 'left outer',
'conditions' => array(
'NewsArticle.id = ImagesNewsArticle.news_article_id'
)
),
array('table' => 'images',
'alias' => 'Image',