Skip to content

Instantly share code, notes, and snippets.

simplejson==3.8.1
requests==2.6.0
robotframework==2.9.2
robotframework-selenium2library==1.7.4
robotframework-pabot==0.20

Keybase proof

I hereby claim:

  • I am vipulnsward on github.
  • I am vipulnsward (https://keybase.io/vipulnsward) on keybase.
  • I have a public key ASDZmmQCKw8hgS-vLO6etlbk41-Og9OjEN3c1u5fMv6B4Qo

To claim this, I am signing this object:

@vipulnsward
vipulnsward / designer.html
Last active August 29, 2015 14:09
designer
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../core-icons/core-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-menu-button/core-menu-button.html">
<link rel="import" href="../topeka-elements/category-images.html">
<link rel="import" href="../core-icons/av-icons.html">
<link rel="import" href="../paper-fab/paper-fab.html">
<script src="http://fb.me/react-with-addons-0.11.0.js"></script>
<body>
<script id="jsbin-javascript">
/** @jsx React.DOM */
var App = React.createClass({displayName: 'App',
getInitialState: function() {
var date = new Date();
var hour = date.getHours();
require 'bigdecimal'
multiplier = Rational(1,10)
number = BigDecimal.new('1.1773748397827148')
(number / BigDecimal.new(multiplier.to_f.to_s)).round * multiplier
# Result -
# On MRI 2.1.1-
# (6/5) (Class - Rational)
(main)> price_greater_than_200 = NSPredicate.predicateWithFormat("price > 200")
=> #<NSComparisonPredicate:0x1293bc50>
(main)> products.filteredArrayUsingPredicate(price_greater_than_200)
=> [#<Product:0x9b4f780 @name="iPad Mini" @price=329 @launched_on=2012-11-02 00:00:00 +0530>, #<Product:0x9b4fac0 @name="MacBook Pro" @price=1699 @launched_on=2012-06-11 00:00:00 +0530>, #<Product:0x9b4fe00 @name="iMac" @price=1299 @launched_on=2012-11-02 00:00:00 +0530>]
(main)> price_greater_than_equal = NSPredicate.predicateWithFormat("price >= 1299")
=> #<NSComparisonPredicate:0x9b1b740>
(main)> products.filteredArrayUsingPredicate(price_greater_than_equal)
=> [#<Product:0x9b4fac0 @name="MacBook Pro" @price=1699 @launched_on=2012-06-11 00:00:00 +0530>, #<Product:0x9b4fe00 @name="iMac" @price=1299 @launched_on=2012-11-02 00:00:00 +0530>]
(main)>> price_between = NSPredicate.predicateWithFormat("price BETWEEN {100 , 2000}")
=> #<NSComparisonPredicate:0x1293f3e0>
(main)> iPadMiniPredicate = NSPredicate.predicateWithFormat("name = 'iPad Mini'")
=> #<NSComparisonPredicate:0x9d27250>
(main)> products.filteredArrayUsingPredicate(iPadMiniPredicate)
=> [#<Product:0x9b4f780 @name="iPad Mini" @price=329 @launched_on=2012-11-02 00:00:00 +0530>]
(main)> macbookProPredicate = NSPredicate.predicateWithFormat("name = 'MacBook Pro'")
=> #<NSComparisonPredicate:0x9d24d70>
(main)> products.filteredArrayUsingPredicate(macbookProPredicate)
=> [#<Product:0x9b4fac0 @name="MacBook Pro" @price=1699 @launched_on=2012-06-11 00:00:00 +0530>]
(main)> products.valueForKeyPath("@count")
=> 4
(main)> products.valueForKeyPath("@sum.price")
=> 3526.0
(nil)? products.valueForKeyPath("@avg.price")
=> 881.5
(nil)? products.valueForKeyPath("@max.price")
=> 1699
(main)> products.valueForKeyPath("@min.launched_on")
=> 2012-06-11 00:00:00 +0530
df = NSDateFormatter.alloc.init # Date Formatter
df.dateFormat = "yyyy-MM-dd"
Product.new("iPhone 5", 199, df.dateFromString("2012-09-21")).price
products = [Product.new("iPhone 5", 199, df.dateFromString("2012-09-21")),Product.new("iPad Mini", 329, df.dateFromString("2012-11-02")),Product.new("MacBook Pro",1699, df.dateFromString("2012-06-11")),Product.new("iMac", 1299, df.dateFromString("2012-11-02"))]
class Product
def initialize(name, price, launched_on)
@name, @price, @launched_on = name, price, launched_on
end
def name
@name
end