Skip to content

Instantly share code, notes, and snippets.

📚
Being Geek!

Shekhar Prasad Rajak Shekharrajak

📚
Being Geek!
Block or report user

Report or block Shekharrajak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Shekharrajak
Shekharrajak / rubi_testing_manual.md
Created Mar 26, 2019
sympy.integrals.rubi test
View rubi_testing_manual.md

In [2]: rubi_integrate(x**2 + x + 1, x)                                                                                                                                                                       
Out[2]: 
 3             
x        ⌠     
── + x + ⎮ x dx
3        ⌡     

In [3]: rubi_integrate(x/(x**2+2*x+1), x)                                                                                                                                                                     
View daru_benchmark.rb
require_relative 'benchmarker'
$:.unshift File.expand_path("../../../lib", __FILE__)
DF_SIZE_POW_10 = [2, 3, 4, 5, 6, 7]
DF_SIZE_POW_10.each do |df_size|
puts "DataFrame of size : #{10**df_size} "
Benchmarker.benchmark_create_df(10**df_size)
View daru_benchmarker.rb
require 'benchmark'
$:.unshift File.expand_path("../../../lib", __FILE__)
require 'daru'
class Benchmarker
@df = Daru::DataFrame.new()
@df_size = 0
View gist:0ab56c74c16ca6e49cfeedc20fee0624

If you're writing web applications with Ruby there comes a time when you might need something a lot simpler, or even faster, than Ruby on Rails or the Sinatra micro-framework. Enter Rack.

Rack describes itself as follows:

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Before Rack came along Ruby web frameworks all implemented their own interfaces, which made it incredibly difficult to write web servers for them, or to share code between two different frameworks. Now almost all Ruby web frameworks implement Rack, including Rails and Sinatra, meaning that these applications can now behave in a similar fashion to one another.

At it's core Rack provides a great set of tools to allow you to build the most simple web application or interface you can. Rack applications can be written in a single line of code. But we're getting ahead of ourselves a bit.

View createFileNodeServer.js
app.get('/createFile', (req, res) => {
var fs = require("fs");
var writeStream = fs.createWriteStream("./data/dynamic_file.txt");
writeStream.write("Hi, Users. I am generated after the /createFile get request. ");
writeStream.write("Thank You.");
writeStream.end();
res.send('File is generated. Click <a href="/resources/dynamic_file.txt"> here </a> to see the file. Save/download the file using ctrl+s');
});
View serverStaticFile.js
app.use('/resources', express.static(path.join(__dirname, './data')));
View nodeServer.js
var express = require('express');
var app = express();
var port = process.env.PORT || 1729;
app.listen(port, function () {
console.log('Server has started at port ' + port + ' !!');
});
View VimCommands.md

Shortcut Keys Function

Main

Escape key Gets out of the current mode into the “command mode”. All keys are bound of commands.

  • i “Insert mode” for inserting text. Keys behave as expected.
  • : “Last-line mode” where Vim expects you to enter a command such as to save the document.

Navigation keys

View RubyConf_proposal_2017.md

Data Analysis and Visualisation in Ruby with daru

In this talk we will be learning about Ruby gem daru (Data Analysis in RUby); a library for storage, analysis, manipulation and visualisation of data. We will learn about simple and fast techniques to import & analyse data sets, exporting data and plotting charts for gaining quick insights into your data, using daru dataframe. Also we will see how daru gem is useful in Ruby framework web applications (e.g. Rails/Sinatra/Nanoc) to directly analyse/manipulate data and display interactive charts to visualise the informations, which helps users to understand it better.

Outlines

  • Introducing myself
  • What is daru ?
  • Why to use daru and what makes it powerful gem for data analysis and visualisation ?
View pivot_table_testing_daru.rb
require 'pivot_table'
require 'daru'
class Order
attr_reader :city, :quarter, :top_sales
def initialize args
args.each do |k,v|
instance_variable_set("@#{k}", v) unless v.nil?
end
end
You can’t perform that action at this time.