Skip to content

Instantly share code, notes, and snippets.

View rohit-lakhanpal's full-sized avatar

Rohit Lakhanpal rohit-lakhanpal

  • Melbourne, VIC, Australia
  • 12:36 (UTC +10:00)
View GitHub Profile
@rohit-lakhanpal
rohit-lakhanpal / web.config
Created August 11, 2020 12:37
Configuring Azure to reconcile client and server side routing. [In the public folder, let’s add a web.config XML file with the following content:]
<?xml version="1.0"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="React Routes" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
@rohit-lakhanpal
rohit-lakhanpal / bot.html
Created October 15, 2019 20:49
A direct line bot user interface.
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
html,
body {
height: 100%
}
@rohit-lakhanpal
rohit-lakhanpal / Dockerfile
Created September 17, 2018 04:10 — forked from ju2wheels/Dockerfile
Docker Dockerfile reference template
# Last updated: 08/24/2916
#
# Total instructions available: 18
#
# https://docs.docker.com/engine/reference/builder/
#
# You can use a .dockerignore file in the same context directory as
# your Dockerfile to ignore files in the context before sending them
# to the Docker daemon for building to speed up building.
@rohit-lakhanpal
rohit-lakhanpal / Speakers.json
Last active August 14, 2017 00:52
Speakers from NDC Sydney.
[
{
"name":"Aaron Powell",
"website":"http://ndcsydney.com/speaker/aaron-powell/",
"bio":"I like long walks on the beach talking about JavaScript"
},
{
"name":"Adam Cogan",
"website":"http://ndcsydney.com/speaker/adam-cogan/",
"bio":"Chief Architect at SSW"
@rohit-lakhanpal
rohit-lakhanpal / Speakers.json
Created August 14, 2017 00:42
Speakers from NDC Sydney. Extracted by running the following code on http://ndcsydney.com/speakers/ var speakers = []; var id = 1; $(".boxed-speaker").each(function (e, i){ var website = $(i).attr("href"); var name = $(i).find(".title > h2").html(); var bio = $(i).find(".title > p").html(); speakers.push({ "name": name, "website":website, "bio":…
[
{
"name":"Aaron Powell",
"website":"http://ndcsydney.com/speaker/aaron-powell/",
"bio":"I like long walks on the beach talking about JavaScript",
"id":1
},
{
"name":"Adam Cogan",
"website":"http://ndcsydney.com/speaker/adam-cogan/",
<?xml version="1.0" encoding="UTF-8" ?>
<Response>
<Dial>
<Conference waitUrl="http://twimlets.com/holdmusic?Bucket=com.twilio.music.ambient">pv-conference</Conference>
</Dial>
</Response>
@rohit-lakhanpal
rohit-lakhanpal / InvokePowershellAndSleep.ps1
Created November 4, 2016 00:24
This powershell script is able to invoke another powershell script every 90 seconds & pipe the output to a file
# This function generates a new filename based on the current datetime
function GenerateFileNamePerHour
{
# Store the current date in a variable
$cDate = Get-Date
$val = ("{0}_{1}_{2}-{3}00HRS.log" -f $cDate.Day, $cDate.Month, $cDate.Year, $cDate.Hour)
return $val
}
# This script will run till the 328th day of the year
@rohit-lakhanpal
rohit-lakhanpal / CheckJsonValueFromRedis.ps1
Created November 3, 2016 23:57
This PowerShell script pretty prints JSON values from a REDIS cache.
# Define redis host & auth credentials
$redisHost = "redis.local"
$redisAuth = "redispwd"
# Define per site variables stored in redis
$sites = @("server-01","server-01")
# Define function to Pretty Print Json (and replace escaped json string)
function CleanJson($data)
{
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>
Apache Web Server <!--#echo var="SCRIPT_NAME" -->
</title>
</head>
<body>
@rohit-lakhanpal
rohit-lakhanpal / RevealingModulePattern.js
Created April 19, 2016 04:54
JS-Revealing Module Pattern: Shopping basket implemented using this pattern. The module itself is completely self-contained in a global variable called basketModule. The basket array in the module is kept private and so other parts of our application are unable to directly read it. It only exists with the module's closure and so the only methods…
var basketModule = (function () {
// privates
var basket = [];
function doSomethingPrivate() {
//...
}