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
| #def unescapeHTML(string) | |
| # str = string.dup | |
| # str.gsub!(/&(.*?);/n) { | |
| # match = $1.dup | |
| # case match | |
| # when /\Aamp\z/ni then '&' | |
| # when /\Aquot\z/ni then '"' | |
| # when /\Agt\z/ni then '>' | |
| # when /\Alt\z/ni then '<' | |
| # when /\A#(\d+)\z/n then Integer($1).chr |
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
| #array = [ [3], | |
| # [7 ,4], | |
| # [2, 4, 6], | |
| # [8, 5, 9, 3] | |
| # ] | |
| array =[[75], | |
| [95,64], | |
| [17,47,82], | |
| [18,35,87,10], | |
| [20,04,82,47,65], |
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
| require 'profile' | |
| count = 0 | |
| words = File.read("/usr/share/dict/words") | |
| word12 = words.scan(/^............\n/) | |
| puts word12.count | |
| ---------------------------------------------- | |
| require 'profile' | |
| count = 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
| require 'rubygems' | |
| require 'mechanize' | |
| require 'httparty' | |
| options = { | |
| body: { | |
| IdNo: '02401C0123442014' | |
| } | |
| } | |
| response = HTTParty.post('http://courtnic.nic.in/DDC_TisHazari/detail.asp', options) |
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
| require 'yelp' | |
| require 'csv' | |
| require 'nokogiri' | |
| require 'open-uri' | |
| require 'mechanize' | |
| names = [] | |
| csv_file = File.open('/home/pardeep/Desktop/web scrapper/bakery/coffee_script/coffee_names.csv').read | |
| CSV.parse(csv_file, :headers => true).each{|ob| names << ob[0]} | |
| names = names.uniq |
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
| #!/usr/bin/env ruby | |
| require "openssl" | |
| require 'digest/sha2' | |
| require 'base64' | |
| # We use the AES 256 bit cipher-block chaining symetric encryption | |
| alg = "AES-256-CBC" | |
| # We want a 256 bit key symetric key based on some passphrase | |
| digest = Digest::SHA256.new |
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
| # | |
| # Working with branches | |
| # | |
| # Get the current branch name (not so useful in itself, but used in | |
| # other aliases) | |
| branch-name = "!git rev-parse --abbrev-ref HEAD" | |
| # Push the current branch to the remote "origin", and set it to track | |
| # the upstream branch | |
| publish = "!git push -u origin $(git branch-name)" |
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
| require 'date' | |
| def week_dates( week_num ) | |
| year = Time.now.year | |
| week_start = Date.commercial( year, week_num, 1 ) | |
| week_end = Date.commercial( year, week_num, 7 ) | |
| (week_start..(week_end - 2)).each do |date| | |
| puts date.strftime('%d-%m-%Y (%A)') | |
| puts "\n---- Things to do ----\n\n\n" | |
| str = <<-EOF |
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
| https://asciinema.org/a/c61t971nzlckj0xo86ienfvgt | |
| cp /Applications/RubyMine.app/Contents/bin/rubymine.vmoptions ~/Library/Preferences/RubyMine70/. | |
| vi ~/Library/Preferences/RubyMine70/rubymine.vmoptions |
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
| require 'open-uri' | |
| require 'nokogiri' | |
| require 'fileutils' | |
| lesson_url = ARGV.first | |
| dir_chapter_name = lesson_url.split('/')[4] | |
| lesson_url_id = lesson_url.split('/')[5] | |
| def get_image_urls(url) | |
| urls = [] |
OlderNewer