Skip to content

Instantly share code, notes, and snippets.

Avatar

Akshay akshaysasidrn

View GitHub Profile
View stars-export-1639045490070.json
{
"id": "dbe889f1-05ec-47b5-a117-d894706420c7",
"name": "Stars",
"slug": "github-star-history",
"isPublic": true,
"organizationId": "1d89c866-802d-4e0a-a9ef-05660d38a0f4",
"currentVersionId": "ac5fc98a-23a7-470a-a417-84f1836cc7ba",
"userId": "5d0e3769-e0c6-42cd-a7b9-a112e178296f",
"createdAt": "2021-12-09T12:22:10.668Z",
"updatedAt": "2021-12-09T12:24:09.788Z",
View Dockerfile
# Base image
FROM ubuntu:latest
# Install Ruby
RUN apt-get update -y && apt-get install -y ruby
# Install Firefox
RUN \
apt-get install -y software-properties-common && \
apt-add-repository ppa:mozillateam/firefox-next && \
View webpacker.md

Webpacker/Rails

Problem to solve:

Compiled file served by webpacker is larger than the original file. So inorder to debug the problem, needed to figure out the default config by which webpacker is setup in the Rails app.

Webpacker default enviroment

This is the enviroment that is required from @rails/webpacker.

View script_execution.md

You can tell the browser how to execute the scripts. By default, browser runs the script immediately by pausing HTML parsing. Else you can specify async or defer with the script tag to either run script asynchronously or defer it until HTML is parsed.

<script src="script.js"></script>

<script async src="script.js"></script>

<script defer src="script.js"></script>

@akshaysasidrn
akshaysasidrn / hipchat_slash_commands.md
Last active Sep 18, 2017
Implementing slash commands in HipChat
View hipchat_slash_commands.md

Slash commands in HipChat can be implemented by making use of Add-ons. HipChat Add-ons are web apps which can be integrated to the HipChat client.

As the doc states:

'A HipChat add-on is just a set of "capabilities" that implement an OAuth based authentication flow, a set of REST APIs, and JavaScript APIs.'

Installation flow

  • User begins installation of add-on in the HipChat server.
  • HipChat server then retrieves hosted add-on's capabilities descriptor via GET.
  • HipChat server registers the consumer and then posts OAuth consumerID/secret via POST to the Add-on.
  • This info has to be saved as it will be required to make calls to the HipChat REST API.
View Jenkinsfile
pipeline {
agent any
stages {
stage('Build') {
steps {
echo 'Building..'
}
}
View cricket_simulation.rb
module CricketSimulation
WIN = :win
LOSE = :lose
TIE = :tie
# Team class holds the team attributes.
class Team
attr_accessor :teamname, :player_line_up, :first_batting, :result
def initialize(team_name, players)
@teamname = team_name
View sheet_parse_update.rb
require 'roo'
sheet = Roo::Spreadsheet.open("../../../../../tmp/missing_mapping.xlsx", clean: true)
headers = sheet.row(1)
mappings = []
sheet.each(sku: headers[0], category: headers[1], sku_type: headers[2]) do |hash|
mappings << hash
end
mappings.shift
invalid = []
def update_missing_label_category(mappings, invalid = [])