Skip to content

Instantly share code, notes, and snippets.

(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>
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)
<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();
@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">

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:

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