Skip to content

Instantly share code, notes, and snippets.

Avatar

Kunwar Aditya Raghuwanshi kitwalker12

View GitHub Profile
@kitwalker12
kitwalker12 / game_of_life.java
Last active Jan 28, 2020
Game of Life Boilerplate
View game_of_life.java
public class GameOfLife {
GameOfLife() { // state may be passed here
}
public void evolve {
}
public void print {
}
}
View my_logger.rb
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")
{
View keybase.md

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:

View barewords.rb
def progname; "Dis-organizer"; end
module DisOrganizer
def version; "Mark 7"; end
end
class CoffeeEnabled
def service_inquiry
"order you a coffee"
end
View rake_file_list.rb
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 Mar 7, 2018
Upgrade Circleci to 2.0 Config
View config.yml
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 Jan 19, 2018
Rails Interview Project
View project.md

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 Jan 10, 2018
flatten an array of arbitrarily nested arrays
View gist:62f09d79f44dd19e2f2e7823f105b79f
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])
@kitwalker12
kitwalker12 / images.xml
Last active Mar 24, 2021
Amazon MWS Beauty Product Feed XML Sample
View images.xml
<?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>