This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Author : Paritosh Piplewar | |
| Description : solution for recursion . | |
| */ | |
| function recursiveFunction(){ | |
| static $breaking_point = 1; | |
| // here 5 is the extreme limit which breaks the function | |
| if($breaking_point == 5){ | |
| break; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * Leap year concept : year is divided by 4 but not divided by 100.If is divided by both,then it must divided by 400 . | |
| #include <iostream> | |
| using namespace std; | |
| int main(){ | |
| int year; | |
| cin>>year; | |
| if( (year % 4 == 0 && year % 100 != 0) || (year%100 == 0 && year % 400 == 0) ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($) { | |
| $.fn.extend( { | |
| limiter: function(limit, elem) { | |
| $(this).on("keyup focus", function() { | |
| setCount(this, elem); | |
| }); | |
| function setCount(src, elem) { | |
| var chars = src.value.length; | |
| if (chars > limit) { | |
| src.value = src.value.substr(0, limit); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo apt-get update -y | |
| sudo apt-get upgrade -y | |
| #install essential build tools | |
| sudo apt-get -y install wget curl build-essential clang | |
| sudo apt-get -y install bison openssl zlib1g | |
| sudo apt-get -y install libxslt1.1 libssl-dev libxslt1-dev make | |
| sudo apt-get -y install libxml2 libffi-dev libyaml-dev | |
| sudo apt-get -y install libxslt1-dev autoconf libc6-dev | |
| sudo apt-get -y install libreadline6-dev zlib1g-dev libcurl4-openssl-dev | |
| sudo apt-get -y install libtool libcurl4-openssl-dev libssl-dev apache2-prefork-dev libapr1-dev libaprutil1-dev make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1.9.3p448 :083 > Date.beginning_of_week has | |
| NameError: undefined local variable or method `has' for main:Object | |
| from (irb):83 | |
| from /home/paritsoh/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands/console.rb:47:in `start' | |
| from /home/paritsoh/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands/console.rb:8:in `start' | |
| from /home/paritsoh/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.13/lib/rails/commands.rb:41:in `<top (required)>' | |
| from script/rails:6:in `require' | |
| from script/rails:6:in `<main>' | |
| 1.9.3p448 :084 > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unless File.exist?('Gemfile') | |
| File.write('Gemfile', <<-GEMFILE) | |
| source 'https://rubygems.org' | |
| gem 'rails', github: 'rails/rails' | |
| GEMFILE | |
| system 'bundle' | |
| end | |
| require 'bundler' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Product < ActiveRecord::Base | |
| include AlgoliaSearch | |
| algoliasearch do | |
| attribute find_the_attribute_name do | |
| if foo | |
| 1 | |
| else | |
| 0 | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Mongo db console commands | |
| //showing the existing dbs.. | |
| show dbs | |
| //use test | |
| switching to db test, (only creating it when actually adding new data) | |
| //prompts the name of the working db now | |
| db | |
| //the fllw would prompt the count(), in the link2 collection, in the current db... | |
| >db.links2.count() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Version": "0.0.1", | |
| "Time": "2015-02-12 09:48:22", | |
| "Ack": "Ok", | |
| "Offer": [ ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"responseEnvelope"=>{"timestamp"=>"2015-09-28T22:29:09.135-07:00", "ack"=>"Success", "correlationId"=>"45ae58603e954", "build"=>"17618768"}, "invoice"=>{"merchantEmail"=>"andrew-retailer@greentoe.com", "payerEmail"=>"a.k.ur.l.an.d@gmail.com", "number"=>"0014", "itemList"=>{"item"=>[{"name"=>"Canon EF 100-400mm f/4.5-5.6L IS USM Autofocus Lens", "quantity"=>1.0, "unitPrice"=>10.0, "discountAmount"=>0.0, "taxAmount"=>0.0}]}, "taxCalculatedAfterDiscount"=>false, "currencyCode"=>"USD", "invoiceDate"=>"2015-09-28T22:07:00.000-07:00", "dueDate"=>"2015-09-28T22:07:00.000-07:00", "paymentTerms"=>"DueOnReceipt", "discountAmount"=>0.0, "totalItemDiscountAmount"=>0.0, "taxInclusive"=>false, "shippingAmount"=>0.0, "shippingTaxAmount"=>0.0}, "invoiceDetails"=>{"status"=>"Paid", "totalDiscountAmount"=>0.0, "totalAmount"=>10.0, "origin"=>"API", "createdDate"=>"2015-09-28T22:16:49.000-07:00", "lastUpdatedDate"=>"2015-09-28T22:19:54.000-07:00", "firstSentDate"=>"2015-09-28T22:16:49.000-07:00", "lastSentDate"=>"2015-09-28T22: |
OlderNewer