Skip to content

Instantly share code, notes, and snippets.

@paramaggarwal
paramaggarwal / razzle.config.js
Created October 26, 2017 15:10
Razzle config with support for SASS (with source maps)
"use strict";
const autoprefixer = require("autoprefixer");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const Visualizer = require("webpack-visualizer-plugin");
module.exports = {
modify: (baseConfig, { target, dev }, webpack) => {
const appConfig = Object.assign({}, baseConfig);
@paramaggarwal
paramaggarwal / easing.js
Created November 21, 2017 11:29 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@paramaggarwal
paramaggarwal / index.js
Created December 10, 2018 07:18 — forked from austintackaberry/index.js
Final index.js for i18n-example
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
import { BrowserRouter } from "react-router-dom";
import { IntlProvider, addLocaleData } from "react-intl";
import en from "react-intl/locale-data/en";
import es from "react-intl/locale-data/es";
@paramaggarwal
paramaggarwal / swiggy-invoice-download.js
Created April 29, 2019 16:56
Download Swiggy invoices from Orders page
/*
* Make sure to alow popups so that the invoices can be downloaded.
* Run this in the browser console.
* In case the class name for the div changes, inspect and update.
*/
Array
.from(document.getElementsByClassName('_2uT6l'))
.map((el)=>el.innerText.match(/#([0-9]+)/)[1])
.map((num)=>"https://www.swiggy.com/invoice/download/"+num)
@paramaggarwal
paramaggarwal / day1.sql
Last active October 5, 2019 12:33
PostgreSQL Workshop
-- DROP TABLE books;
CREATE TABLE books
(
id SERIAL PRIMARY KEY,
name CHARACTER VARYING NOT NULL
);
CREATE TABLE editions
(
@paramaggarwal
paramaggarwal / clip.svg
Last active January 17, 2020 11:02
Energy Meter Dashed Gradient Progress
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@paramaggarwal
paramaggarwal / index.html
Created March 20, 2020 12:45
Trying Web Bluetooth
<html>
<script>
function onButtonClick() {
const serviceUuid = "body_composition";
console.log("Requesting Bluetooth Device...");
navigator.bluetooth
.requestDevice({ filters: [{ services: [serviceUuid] }] })
.then(device => {
console.log("Connecting to GATT Server...");
@paramaggarwal
paramaggarwal / README.md
Last active April 9, 2023 18:08
How to authorise Audible in Books app on macOS Big Sur

How to authorise Audible in Books app on macOS Big Sur

As of this writing the token auth flow is broken due to the following reasons:

  1. The country based override causes failure of the "Activate in iTunes" button to show up.
  2. Once the button exists, it attempts to open the Music app rather than the Books app.

Step 0

Before attempting any of this, go to Audible library and download your audiobook and open it, it will get added to Books app on macOS. Now try to play it and it will as for permission to authorise it.

@paramaggarwal
paramaggarwal / README.md
Last active March 23, 2021 03:04
Delete all git tags on remote with particular prefix

Delete all git tags on remote with particular prefix

This will remove all tags with the prefix PREFIX from the remote branch. After that sync your local history with remote.

  • git for-each-ref 'refs/tags/PREFIX*' --format='%(refname:short)' | xargs git push --delete origin
  • git fetch --prune --prune-tags
@paramaggarwal
paramaggarwal / redis_monitor_parser.rb
Last active May 15, 2021 14:45 — forked from bohford/redis_monitor_parser.rb
Redis monitor log parser
# redis-cli monitor > monitor.txt
puts "Scanning redis log..."
ops = Hash.new(0)
lines = File.readlines('monitor.txt'); true
start_time = Time.at(lines[1].split(' ').first.to_f)
end_time = Time.at(lines.last.split(' ').first.to_f)