Skip to content

Instantly share code, notes, and snippets.

@suvrachat
suvrachat / Constructor.js
Created December 6, 2015 05:04
Object instantiation via Constructor Functions
//Ordinary function to be used as constructor
var Employee = function(name, age){
this.name = name;
this.age = age;
}
//Instantiate an Employee object using the new keyword
var al = new Employee('al', 50);
console.log('name : ' + al.name + ' age : '); //will return name : al age : 50
@suvrachat
suvrachat / SyntaxConstructs.js
Created December 5, 2015 17:19
Object creation view Syntax Constructs
//Object creation via Object Literal
//prototype chain : obj.__proto__ -> Object().__proto__ -> null
var obj = { a : 'a'}
//Function creation via Function literal
//prototype chain : func.__proto__->Function().__proto__->Object().__proto__->null
var func = function(){
return 2;
}
@suvrachat
suvrachat / proto_traversal.js
Created December 5, 2015 12:46
Traversing the prototype chain
//parent and child will inherit from the Object Prototype
//prototype chain for parent : parent -> Object Prototype
var parent = {
name : 'Tommy',
species : 'dog'
}
//prototype chain for child : child -> Object Prototype
var child = {
name : 'Dexter'
}
@suvrachat
suvrachat / Object.js
Last active May 1, 2024 19:34
Example Object
var employee = {
name : 'Al',
age : 40,
salary : 80000,
incrementSalary : function(increment){
this.salary += increment
}
}
@niksumeiko
niksumeiko / disable-html-form-input-autocomplete-autofill.md
Last active May 1, 2024 19:33
Disable HTML form input autocomplete and autofill

Disable HTML Form Input Autocomplete and Autofill

  1. Add autocomplete="off" onto <form> element;
  2. Add hidden <input> with autocomplete="false" as a first children element of the form.
<form autocomplete="off" method="post" action="">
    <input autocomplete="false" name="hidden" type="text" style="display:none;">
    ...
@suvrachat
suvrachat / Prototype.js
Last active May 1, 2024 19:33
Top level prototype object in Chrome
Object().__proto__ = {
__defineGetter__: __defineGetter__()
__defineSetter__: __defineSetter__()
__lookupGetter__: __lookupGetter__()
__lookupSetter__: __lookupSetter__()
constructor: Object()
hasOwnProperty: hasOwnProperty()
isPrototypeOf: isPrototypeOf()
propertyIsEnumerable: propertyIsEnumerable()
toLocaleString: toLocaleString()
/home/nick/Music:
AC-DC/
All That Remains/
Atreyu/
Avenged Sevenfold/
Black Tide/
Creed/
Crossfade/
Deep Purple/
Disturbed/
@SteveSandersonMS
SteveSandersonMS / BlazorForm.cshtml
Created September 21, 2018 16:29
Validation mockup A: explicit <ValidateXyz> components that take a Func<T>
@* Unfortunately this has to be named BlazorForm, not Form, because we can't differentiate based on casing *@
<form onsubmit=@HandleSubmit>
@ChildContent(_context)
</form>
@functions {
private FormContext _context = new FormContext();
[Parameter] protected RenderFragment<FormContext> ChildContent { get; set; }
[Parameter] protected Action<FormContext> OnSubmit { get; set; }
@martinsam16
martinsam16 / docker-wsl2.md
Last active May 1, 2024 19:28
How to install wsl2 ubuntu + docker + docker-compose

Activate wsl2

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

Install and Configure Ubuntu

Generating Authy passwords on other authenticators


Update 04.04.2020: Please take a look at many of the forks of this gist or comments, where people have updated or improved upon the code. I have not needed this in a long time, which is why the original document has not been updated and the code probably does not work. Stay secure and only copy and paste code that you trust.

There is an increasing count of applications which use Authy for two-factor authentication. However many users who aren't using Authy, have their own authenticator setup up already and do not wish to use two applications for generating passwords.

Since I use 1Password for all of my password storing/generating needs, I was looking for a solution to use Authy passwords on that. I couldn't find any completely working solutions, however I stumbled upon a gist by Brian Hartvigsen. His post had a neat code with it to generate QR codes (beware, thro