Skip to content

Instantly share code, notes, and snippets.

@zephyr-dev
zephyr-dev / homework.md
Created August 10, 2015 14:48
Dakarai homework 3

Dakarai Homework 3

  1. Write a function called pallindrome? that returns true or false. The function should take one string parameter (word). Return true if word is equal to itself backwards. For example: palindrome?("the") should return false. palindrome?("racecar") should return true.
  2. Write a function called anagrams? that returns true or false. The function should take two string parameters (word1, word2). Return true if word1 and word2 are anagrams of one another. An anagram of a word is another word that has the same letters in a different order. For example: anagrams?('god', 'dog') should return true. anagrams?('aabb', 'ab') should return false.
@zephyr-dev
zephyr-dev / new_cuke_config.rb
Created April 14, 2015 13:06
A proposal for refactoring Cuke helpers.
require_relative '../directory/where/those/modules/live'
World(InvestorGroups::MemberApplicationHelper)
class UpdateDealAggregateRatings < ActiveRecord::Migration
def up
execute("
update deals set aggregate_rating = (
select avg(deal_rating_avg.by_user) avg_rating
from (
select avg(deal_ratings.rating) by_user, dr.user_id
from deal_ratings
join deal_reviews dr
on dr.id = deal_ratings.deal_review_id
/* A font by Jos Buivenga (exljbris) -> www.exljbris.com */
@font-face {
font-family: 'MuseoSans';
src: url("/assets/typefaces/museosans_100-webfont.eot");
src: url("/assets/typefaces/museosans_100-webfont.eot?#iefix") format("embedded-opentype"), url("/assets/typefaces/museosans_100-webfont.ttf") format("truetype"), url("/assets/typefaces/museosans_100-webfont.svg#MuseoSans100") format("svg");
font-weight: 100;
font-style: normal;
}
@font-face {
@zephyr-dev
zephyr-dev / gist:5206780
Last active December 15, 2015 05:09
My Work bookmarklet for PT
<a href="javascript%3Aapp.layout.togglePanel(Panel.MY_WORK)%3B%0A">My Work</a>
:tddium:
:tests:
- :type: custom
:command: bundle exec rake jasmine:ci
:invocation: single
:output: exit-status
require 'rake'
require 'rspec'
require 'rspec/mocks/standalone'
class Foo
end
Foo.should_receive(:import)
Foo.import
find(".select2-input").set(friend.name)
wait_for_dom # wait for ajax search to return
find(".select2-result-label").click
page.should have_content(friend.name)
def wait_for_dom
uuid = SecureRandom.uuid
page.evaluate_script <<-EOS
@zephyr-dev
zephyr-dev / gist:3757639
Created September 20, 2012 18:49
Bug with DelegateClass & Array subtraction
astoria:gust (master) ng bm$ irb --simple-prompt
>> require 'delegate'
=> true
>> class Foo < DelegateClass(Object)
>> end
=> nil
>> f = Foo.new(Object.new)
>> array1 = [[f]]
=> [[#<Object:0x007fc92ab72168>]]