Skip to content

Instantly share code, notes, and snippets.

View muraray's full-sized avatar
🎯
Be Water, My Friend.

Murali Ramakrishnan muraray

🎯
Be Water, My Friend.
View GitHub Profile
@muraray
muraray / binarysearch.go
Last active September 26, 2017 10:58
Binary Search in Golang
package main
import "fmt"
func main() {
smallarray := []int{1, 4, 5, 5, 7, 9, 10, 12, 13, 15, 16, 17, 19, 22, 23, 27, 30, 32, 36, 39, 42, 44, 45, 46, 47, 50}
bigarray := []int{
1, 2, 3, 5, 6, 7, 8, 10, 11, 14, 15, 16, 18, 19, 21, 24, 25, 29, 30, 31, 32, 33, 35,
function GenerateMAC(){
var hexDigits = "0123456789ABCDEF";
var macAdd = "";
for (var i = 0; i < 6; i++) {
macAdd += hexDigits.charAt(Math.round(Math.random() * 15));
macAdd += hexDigits.charAt(Math.round(Math.random() * 15));
if (i != 5) macAdd += ":";
}
return macAdd;
@muraray
muraray / gh-pages-deploy.md
Created February 21, 2018 11:21 — forked from cobyism/gh-pages-deploy.md
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@muraray
muraray / Fabric React Rollup Boilerplate
Last active September 7, 2018 09:52
Fabric React Rollup Boilerplate
# Boilerplate structure for React TypeScript and Rollup
A boilerplate to develop react apps and components with TypeScript and Rollup
## Getting Started
```bash
npm init -y
```
@muraray
muraray / Validate Singapore NRIC (as SQL Function)
Created August 29, 2018 09:32
Validate Singapore NRIC (as SQL Function)
GO
/****** Object: UserDefinedFunction [dbo].[ValidateNRIC] Script Date: 08/29/2018 5:24:04 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Murali, scanmurali@gmail.com>
-- Create date: <2018-04-28 17:30:50.723>
-- Description: <Function validates the supplied NRIC string>
@muraray
muraray / localstorage-actions.js
Last active September 14, 2018 04:56
How to Localstorage
const unique_incr = () =>
('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/1|0/g, function() {
return (0 | (Math.random() * 16)).toString(16)
})
const STORAGE_KEY = 'todos';
var fetch = () => JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')
var save = todos => localStorage.setItem(STORAGE_KEY, JSON.stringify(todos))
var state = { todos: [] }
@muraray
muraray / .babelrc
Last active October 8, 2018 07:03
React Rollup Bootstrap
{
"presets": [ "es2015-rollup", "react" ],
"plugins": [ "external-helpers", "transform-decorators-legacy" ]
}
@muraray
muraray / iterm2-solarized.md
Created October 2, 2019 15:12 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@muraray
muraray / fabric-ui-react-parcel-bootstrap.md
Created February 15, 2020 02:31
Fabric-UI React Parcel Bootstrap

Fabric-UI React Parcel Bootstrap

A minimum viable Fabric-UI React app with Parcel Bundler

What's inside?

  • parcel-bundler
  • react
  • react-dom
  • office-ui-fabric-react
/// <summary>
/// ''' Class to Encrypt and Decrypt From APS previous Version.
/// </summary>
public sealed class EncryptDecrypt
{
private EncryptDecrypt()
{
}
// Encrypts specified plaintext using Rijndael symmetric key algorithm