Skip to content

Instantly share code, notes, and snippets.

View kitwalker12's full-sized avatar

Kunwar Aditya Raghuwanshi kitwalker12

View GitHub Profile
@kitwalker12
kitwalker12 / game_of_life.java
Last active January 28, 2020 00:20
Game of Life Boilerplate
public class GameOfLife {
GameOfLife() { // state may be passed here
}
public void evolve {
}
public void print {
}
}
class MyLogger < ActiveSupport::TaggedLogging
def initialize(logger)
super(logger)
logger.formatter = formatter
end
def formatter
Proc.new{|severity, time, progname, msg|
formatted_time = time.strftime("%Y-%m-%d %H:%M:%S")
{

Keybase proof

I hereby claim:

  • I am kitwalker12 on github.
  • I am adi_r (https://keybase.io/adi_r) on keybase.
  • I have a public key ASDNzGWok7brUk7Imh3wXz09gq6basjAZT0BcWiHzY9mLgo

To claim this, I am signing this object:

def progname; "Dis-organizer"; end
module DisOrganizer
def version; "Mark 7"; end
end
class CoffeeEnabled
def service_inquiry
"order you a coffee"
end
@kitwalker12
kitwalker12 / rake_file_list.rb
Created August 1, 2018 05:12
Rake File Lists
source_files = Rake::FileList.new("**/*.md", "**/*.markdown") do |fl|
fl.exclude("~*")
fl.exclude(/^scratch\//)
fl.exclude do |f|
`git ls-files #{f}`.empty?
end
end
task :default => :html
task :html => source_files.ext(".html")
@kitwalker12
kitwalker12 / config.yml
Created March 7, 2018 22:28
Upgrade Circleci to 2.0 Config
version: 2
jobs:
build:
parallelism: 3
working_directory: ~/foo/bar
docker:
- image: circleci/ruby:2.3-node-browsers
- image: circleci/postgres:9.4
- image: circleci/redis:3.2
- image: circleci/rabbitmq:3.6.6
@kitwalker12
kitwalker12 / project.md
Last active February 19, 2023 08:01
Rails Interview Project

Product Management Tool (Rails/JS)

Your task is to create a simple product management tool that lets you create products and search products in a listing page. You are required to use Ruby on Rails (>=5) and React/Vue/Ember for development.

Requirements

Your app will implement 3 models.

  • Product which contains the following attributes/validations:
    • name (string (0-1024 chars), unique)
    • upc (string (10,12 or 13 chars), unique, only numeric characters (0-9) allowed)
@kitwalker12
kitwalker12 / gist:62f09d79f44dd19e2f2e7823f105b79f
Created January 10, 2018 00:07
flatten an array of arbitrarily nested arrays
def flatten_array(arr)
arr.reduce([]) do |res, item|
item.kind_of?(Array) ? res + flatten_array(item) : res << item
end
end
# flatten_array( [[1,2,[3]],4])
0xFCb2654F0Eaf900534C1b4E876b9ED5e00a267c9
@kitwalker12
kitwalker12 / images.xml
Last active June 11, 2024 16:37
Amazon MWS Beauty Product Feed XML Sample
<?xml version="1.0" encoding="utf-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>AXXXXXXXXXX</MerchantIdentifier>
</Header>
<MessageType>ProductImage</MessageType>
<Message>
<MessageID>1</MessageID>
<OperationType>Update</OperationType>