Skip to content

Instantly share code, notes, and snippets.

Andy Bas andyjbas

Block or report user

Report or block andyjbas

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase
### Keybase proof
I hereby claim:
* I am andyjbas on github.
* I am andyjbas (https://keybase.io/andyjbas) on keybase.
* I have a public key whose fingerprint is 19BC E9F2 DD9B 539E 74DF B057 9D97 AC59 EA27 12EC
To claim this, I am signing this object:
View gist:f0001ca8304d6b381e41
http://www.testflightapp.com/install/da6b118ced23896df5cf2bfbef91706f-MTIwNTI2OTU/
@andyjbas
andyjbas / gist:9962218
Last active Jul 19, 2018
Disable CSS Animations in Poltergeist & Phantomjs. Phantomjs does not like to wait for animations, and you can run in to nasty test flickers because of it. This pattern will disable animations in test env, and not touch any app code.
View gist:9962218
# env.rb or spec_helper.rb

Capybara.register_driver :poltergeist do |app|
  opts = {
    extensions: ["#{Rails.root}/features/support/phantomjs/disable_animations.js"] # or wherever
  }

  Capybara::Poltergeist::Driver.new(app, opts)
end
View gist:4733732
array = ["andy", "eric", "bloc"]
array.each_with_index do |element, index|
puts "The index of #{element} is #{index}"
end
# => The index of andy is 0
# => The index of eric is 1
# => The index of bloc is 2
View gist:4700490
class FutureValue
def initialze
end
def annual(rate, years, annual_contribution=0, initial_investment)
pv = self.pv(rate, annual_contribution, years, initial_investment)
pv * (1 + rate)**years
end
# where R is the periodic yield, A is the periodic payment,
View gist:4698761
// grab new items html
var newItems = "<%= j render(partial: 'endless_append', locals: { items: @feed_items }) %>";
// fetch the scroll position
// used to set the window location back after below hack
var scroll_position = $(window).scrollTop();
// append new items to isotope, as usual
$("#feed_list").append( newItems );
View gist:4670925
function Car( model, year, miles ) {
this.model = model;
this.year = year;
this.miles = miles;
}
// Note here that we are using Object.prototype.newMethod rather than
View gist:4670921
function Car( model, year, miles ) {
this.model = model;
this.year = year;
this.miles = miles;
}
// Note here that we are using Object.prototype.newMethod rather than
View gist:4617448
$("#feed").on("click", ".multicheck", function(e) {
$(this).toggleClass("checked");
toggleSorting(this);
return false;
});
View gist:4588121
class RPNCalculator
attr_accessor :stack
def initialize
self.stack = Array.new
end
def push(val)
self.stack.push(val.to_f)
end
You can’t perform that action at this time.