Skip to content

Instantly share code, notes, and snippets.

@arvindr21
arvindr21 / input.scss
Created Nov 23, 2020
Generated by SassMeister.com.
View input.scss
/// @group fonts
///
/* Font family variations
************************* */
$font-family-swiss: Swiss-721;
$font-swiss: $font-family-swiss;
$font-swiss-condensed: SwissCondensed;
$font-marriotticons: MarriottIcons;
@arvindr21
arvindr21 / angular.json
Created Aug 16, 2020 — forked from gsans/angular.json
Remove CommonJS or AMD dependencies optimization bailouts warnings for AWS Amplify using Angular v10
View angular.json
"build": {
"builder": "@angular-devkit/build-angular:browser",
...
"options": {
"allowedCommonJsDependencies": ["crypto-js", "@aws-sdk/eventstream-marshaller", "buffer", "js-cookie",
"@aws-crypto", "zen-observable", "@aws-sdk/util-utf8-node", "@aws-crypto/sha256-js", "@aws-sdk/util-buffer-from",
"@aws-sdk/smithy-client", "@aws-sdk/middleware-serde", "@aws-sdk/middleware-user-agent",
"@aws-sdk/middleware-retry", "@aws-sdk/middleware-signing", "@aws-sdk/middleware-content-length",
"@aws-sdk/middleware-host-header", "@aws-sdk/config-resolver", "@aws-sdk/s3-request-presigner",
"@aws-sdk/util-format-url", "@aws-sdk/util-create-request", "@aws-sdk/property-provider",
View prepare-commit-msg.sh
#!/bin/bash
#
# Inspects branch name and checks if it contains a Jira ticket number (i.e. ABC-123).
# If yes, commit message will be automatically prepended with [ABC-123].
#
# Useful for looking through git history and relating a commit or group of commits
# back to a user story.
#
View Reading configuration files before application startup in Angular2 final release.md

Reading data before application startup in Angular 2

In this demonstration I will show you how to read data in Angular2 final release before application startup. You can use it to read configuration files like you do in other languages like Java, Python, Ruby, Php.

This is how the demonstration will load data:

a) It will read an env file named 'env.json'. This file indicates what is the current working environment. Options are: 'production' and 'development';

b) It will read a config JSON file based on what is found in env file. If env is "production", the file is 'config.production.json'. If env is "development", the file is 'config.development.json'.

View example-ajax-enqueue.php
<?php
function example_ajax_enqueue() {
// Enqueue javascript on the frontend.
wp_enqueue_script(
'example-ajax-script',
get_template_directory_uri() . '/js/simple-ajax-example.js',
array('jquery')
);
@arvindr21
arvindr21 / explanation.md
Created Oct 4, 2019 — forked from masak/explanation.md
How is git commit sha1 formed
View explanation.md

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry.

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <jnthn@jnthn.net>
Date:   Sun Apr 15 16:35:03 2012 +0200

    When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.
@arvindr21
arvindr21 / backends.js
Created Apr 23, 2019 — forked from kevinswiber/backends.js
Express Gateway Example with Multiple Services
View backends.js
const express = require('express');
const forum = express();
forum
.get('/healthz', (req, res, next) => {
res.send({ name: 'forum', status: 'healthy' });
next();
})
.get('/d/:id', (req, res, next) => {
@arvindr21
arvindr21 / 0.README.md
Created Nov 15, 2018 — forked from agentcooper/0.README.md
Telegram chat backup/export
View 0.README.md

How to use

  1. Login to https://web.telegram.org
  2. Copy-paste contents of telegram-scripts.js into JS console
  3. Run showContacts() to get the list of contacts with ids
  4. Run saveChat(userId) where userId is the id from step 3

Process can take a while, check console for progress. Occasionall FLOOD_WAIT errors are expected. Once done, browser will download the JSON file.

Motivation

@arvindr21
arvindr21 / git-checkout-pr
Created Jul 5, 2018 — forked from mandrizzle/git-checkout-pr
Easily checkout pull requests locally from Atlassian Bitbucket Server (Stash)
View git-checkout-pr
#!/bin/sh
# Usage: `git checkout-pr <pull-request-id>`
#
# Make this file executable and place in a $PATH directory
# The name of the file is important. It has to be named `git-checkout-pr` for the usage to be `git checkout-pr`
# Every pull request on stash has 2 branches. One is called `merge` which is a branch that is merged with its destination.
# The other is `from` which is the unmodified revision that was pushed. This script checks out the merge branch.
# If you want to checkout the pr that is not pre-merged with it's destination, change all occurances of `merge` to `from`
@arvindr21
arvindr21 / object-watch.js
Created Jun 21, 2018 — forked from riddy/object-watch.js
object.watch polyfill
View object-watch.js
/**
* DEVELOPED BY
* GIL LOPES BUENO
* gilbueno.mail@gmail.com
*
* LEARN HOW TO USE IT:
* http://watch.k6.com.br
* FORK:
* https://gist.github.com/1627705
*/