I hereby claim:
- I am mrgenixus on github.
- I am mrgenixus (https://keybase.io/mrgenixus) on keybase.
- I have a public key whose fingerprint is 8C09 39C5 4B48 7962 8F65 4F16 66C4 B41B 363C DD51
To claim this, I am signing this object:
| module Starbucks | |
| def self.order(&block) | |
| order = Order.new | |
| order.instance_eval(&block) | |
| return order.drinks | |
| end | |
| class Order |
| require 'date' | |
| def generate_date do | |
| now = Date.today().to_datetime() | |
| weeks_from_now = Random.rand(8) | |
| day_random = RandomGaussian.new(0.5, 0.25).rand() | |
| day_of_week = (day_random*7+1.5).round() % 7 | |
| time_random = RandomGaussian.new(0.5, 0.1).rand() | |
| time = ((time_random*48+12).round() % 48)/2 |
| $(function() { | |
| var counter =0; | |
| function loadNext() { | |
| $('<div>').load('api/thumbnails/whatever/your/url/is?page=' + counter++).appendTo('#thumbnails'); | |
| } | |
| $(window).on('scroll', function() { | |
| if ($(document).scrollTop() > document.body.height() - (window.clientHeight / 25)) { | |
| loadNext(); | |
| }); |
| context "policy_scope" do | |
| let(:user) { create :user } | |
| let(:admin_user) { create :user, :admin } | |
| let!(:bookings) { create_list :booking, 2 } | |
| let!(:user_bookings) { create_list :booking, 2, user: user } | |
| it "should not include any models for non-admins" do | |
| BookingPolicy::Scope.new(user, Bookings).resolve.tap do |scope| | |
| expect(scope.all.count).to eq 0 | |
| end |
I hereby claim:
To claim this, I am signing this object:
Thanks so much for posting this. I have been in far too many of those places; even then the reality isn't as bad as described, in most cases, the person you're dealing with may not be responsible for your bad experience.
As Entrepreneurs and owners, and operators, we should also remember that we employ these people and that when we are in better shape we should find out our employees' stories and support them. If we're doing it right, they are our bread and butter, and we owe the sustainability of our model to them, the future of our business depends, to some degree, on their personal successes and failures, and if they can go on if life gives them a sucker punch.
| function pre(process, func){ | |
| return function(){ | |
| return func.apply(process(this), arguments); | |
| } | |
| } | |
| function jquerify (func){ return pre($, func); } | |
| $('div').map(jquerify(function(v, i){ | |
| return this.attr('id'); |
| var newModel = (function(){ | |
| var attributes = {} | |
| var state = { | |
| set: function(stateChange){ | |
| attributes = $.extend({}, attributes, stateChange); | |
| }, | |
| get: function(key) { | |
| return $.extend({}, attributes); |
| (function (n) { // function has no name, is therefore "anonymous" | |
| var i=n*2; | |
| if (i > 4) { | |
| return undefinedFunc(); // causes a "ReferenceError: undefinedFunc is not defined at Object.<anonymous>" | |
| } else { | |
| arguments.callee(i); // recurses, adding the anonymous function to the call stack | |
| } | |
| })(1); |
| class ProductsController < ApplicationController | |
| # [...] Product Crud | |
| def create_review | |
| @product = Product.find params[:id] | |
| review = @product.reviews.new | |
| review.user_id = current_user.id | |
| review.subject = params[:subject].nil? ? "Untitled" : params[:subject]; | |
| review.body = params[:body] |