This file contains 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
a,b=0,1 | |
sum=0 | |
until a >= 4000000 | |
a,b=b,a+b | |
if a <= 4000000 && a.even? | |
sum+=a | |
end | |
end | |
print sum |
This file contains 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
print "Please enter the limits" | |
number_limit=gets | |
limit=number_limit.to_i | |
numbers=[] | |
xor=[] | |
def compute_k(foo) | |
count=0 | |
foo=foo+1 if foo%2==0 | |
until foo ==1 | |
if foo%2==0 |
This file contains 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
# To change this template, choose Tools | Templates | |
# and open the template in the editor. | |
input_limit=gets | |
limit=input_limit.to_i | |
inputs=[] | |
result=0 | |
def compute_result(string1,sub_string) | |
answer=0 |
This file contains 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
<section class="taglineWrap"> | |
<div class="container"> | |
<div class="row-fluid tagline"> | |
<div class="span8"><h2>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, donec odio. Quisque volutpat mattis eros.</h2></div> | |
<div class="span4 action"> | |
<div> | |
<a href="#" class="btn first btn-success">Learn More</a> | |
<span>or</span> | |
<a href="#" class="btn btn-info">Contact Us</a> |
This file contains 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
Variable definition: | |
Looping Constructs: | |
Conditional Statements: | |
This file contains 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
{if edit_mode()} | |
<span class="ez-start-editable-region" data-ez-truc="foo"></span> | |
{/if} | |
{$attribute.content|wash()} | |
{if edit_mode()} | |
<span class="ez-end-editable-region"></span> | |
{/if} |
This file contains 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
# usage rake devlog | |
desc "Creates devlog #{source_dir}/#{posts_dir}" | |
task :devlog do |t| | |
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir) | |
mkdir_p "#{source_dir}/#{posts_dir}" | |
title = "Devlog #{Date.today-7} to #{Date.today}" | |
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}" | |
if File.exist?(filename) | |
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n' | |
end |
This file contains 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
section | |
h All you need to know about consuming APIs | |
br | |
br | |
p Abishek Bhat | |
p Devloper,Plivo | |
h2= ENV.inspect | |
section | |
h HTTP Verbs |
This file contains 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
def cast(item): | |
try: | |
return int(item) | |
except: | |
pass | |
try: | |
return float(item) | |
except: | |
return item | |
_cast=map(cast,_list) |
This file contains 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
SET job.name ' General Data dump for $out, Job date: $date'; | |
SET default_parallel 4; | |
REGISTER 'lib/datalight-0.5.jar'; -- register jar | |
DEFINE attrib com.indix.datalight.pig.udf.AttributeParserUdf(); -- define shortname | |
raw = LOAD 'webpage' USING org.apache.pig.backend.hadoop.hbase.HBaseStorage('f:bas a:a d:*','-caching 100 -loadKey true -gte $startKey -lte $endKey') as (key:chararray, baseUrl:chararray, attributes:chararray, parsedData:map[]); | |
data = FOREACH raw GENERATE key,baseUrl, attrib(attributes, parsedData) as productModel:map[]; | |
rows_without_mpn = FILTER data BY (productModel#'upc'==NULL) AND (productModel#'mpn'==NULL); | |
final= FOREACH rows_without_mpn GENERATE key,baseUrl; | |
STORE final INTO 'pigdata/datadumps/general/$out/$date.gz/' USING PigStorage('\t'); |
OlderNewer