Skip to content

Instantly share code, notes, and snippets.

@amit08255
amit08255 / .zshrc
Created December 22, 2019 19:22 — forked from deepu105/.zshrc
export TERM="xterm-256color" # This sets up colors properly
# workaround as per https://superuser.com/questions/1222867/zsh-completion-functions-broken
FPATH=$HOME/.oh-my-zsh/plugins/git:$HOME/.oh-my-zsh/functions:$HOME/.oh-my-zsh/completions:/usr/share/zsh/site-functions:/usr/share/zsh/$ZSH_VERSION/functions
export FPATH
# set shell
export SHELL=/usr/bin/zsh
@amit08255
amit08255 / stupid-copy-protection.html
Created February 4, 2020 10:39 — forked from karlcow/stupid-copy-protection.html
People trying to put copy protection on their content.
<!-- WP Content Copy Protection script by Rynaldo Stoltz Starts - http://securiilock.com -->
<div align="center"><noscript>
<div style="position:fixed; top:0px; left:0px; z-index:3000; height:100%; width:100%; background-color:#FFFFFF">
<div style="font-family: Tahoma; font-size: 14px; background-color:#FFF000; padding: 10pt;">Please enable your Javascript to see this page as it is meant to appear!</div></div>
</noscript></div>
<script type="text/javascript">
window.onload = function() {
disableSelection(document.body)
@amit08255
amit08255 / better-nodejs-require-paths.md
Created February 20, 2020 12:01 — forked from branneman/better-nodejs-require-paths.md
Better local require() paths for Node.js

Better local require() paths for Node.js

Problem

When the directory structure of your Node.js application (not library!) has some depth, you end up with a lot of annoying relative paths in your require calls like:

const Article = require('../../../../app/models/article');

Those suck for maintenance and they're ugly.

Possible solutions

@amit08255
amit08255 / ts-jest.md
Created February 20, 2020 16:18 — forked from jackawatts/ts-jest.md
Getting started with Typescript, React and Jest

Getting Started

  1. Install:
  • jest: npm install --save-dev jest
  • ts-jest: npm install --save-dev ts-jest @types/jest
  1. Modify package.json
    "transform": {
      "^.+\\.tsx?$": "ts-jest"
    },
@amit08255
amit08255 / deepCopy.js
Created March 25, 2020 05:01 — forked from c7x43t/deepCopy.js
Deep Copy an object very fast
// deep copy:
// String, Number, undefined, null, Set, Map, typed Array, Object, Boolean, RegExp, Date, ArrayBuffer, Node
// Functions, Properties of types: (Primitive, Symbol)
// shallow copy (by reference):
// WeakMap, WeakSet, Symbol
// increased compatibility: IE, Node
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.ASSUME_ES5 = !1;
$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, b, c) {
@amit08255
amit08255 / remove_duplicates.js
Created June 5, 2020 05:05 — forked from lmfresneda/remove_duplicates.js
Remove duplicates from an array of objects in javascript
// FUN METHOD
/**
* Remove duplicates from an array of objects in javascript
* @param arr - Array of objects
* @param prop - Property of each object to compare
* @returns {Array}
*/
function removeDuplicates( arr, prop ) {
let obj = {};
return Object.keys(arr.reduce((prev, next) => {
@amit08255
amit08255 / hide-scrollbar-mixin.scss
Created August 19, 2020 07:28 — forked from pandauxstudio/hide-scrollbar-mixin.scss
Sass mixin to hide scrollbar in Chrome, Firefox, Safari and IE.
@mixin hideScrollbar {
// https://blogs.msdn.microsoft.com/kurlak/2013/11/03/hiding-vertical-scrollbars-with-pure-css-in-chrome-ie-6-firefox-opera-and-safari/
// There is a CSS rule that can hide scrollbars in Webkit-based browsers (Chrome and Safari).
&::-webkit-scrollbar {
width: 0 !important
}
// There is a CSS rule that can hide scrollbars in IE 10+.
-ms-overflow-style: none;
// Use -ms-autohiding-scrollbar if you wish to display on hover.
@amit08255
amit08255 / XORCipher.js
Created December 17, 2020 19:56 — forked from sukima/XORCipher.js
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/
@amit08255
amit08255 / gist:37deb39fc8ae3373f645652307815bb6
Created December 17, 2020 19:57 — forked from EvanHahn/gist:2587465
Caesar shift in JavaScript
/*
JavaScript Caesar shift
by Evan Hahn (evanhahn.com)
"Encrypt" like this:
caesarShift('Attack at dawn!', 12); // Returns "Mffmow mf pmiz!"
And "decrypt" like this: