Skip to content

Instantly share code, notes, and snippets.

@eliza-abraham
eliza-abraham / AES256Cryptor.java
Created August 23, 2018 11:28 — forked from kientux/AES256Cryptor.java
Encrypt and decrypt AES-256 (in CryptoJS way)
/**
* Created by kientux on 3/20/15
*/
import android.util.Base64;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.util.Arrays;
@eliza-abraham
eliza-abraham / config
Created July 14, 2017 07:37
ssh-config
Host project-name
HostName x.x.x.x
User <user-id>
ForwardAgent yes
Port 22
ProxyCommand ssh <user-id>@x.x.x.x -W %h:%p
@eliza-abraham
eliza-abraham / module-pattern.js
Created January 27, 2016 11:01
Module Pattern in Javascript
/* IIFE - Immediately Invoked Function Execution :
This function calls itself immediately after declaration, it creates a new scope and creates "privacy".
Return only the part we need, while keeping the other functions private.
*/
(function () {
// code goes here
})();
// Adding a namespace
var Module = (function () {
@eliza-abraham
eliza-abraham / LICENSE
Last active August 29, 2015 14:27 — forked from ourmaninamsterdam/LICENSE
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@eliza-abraham
eliza-abraham / webonise_cyberoam_login.sh
Last active August 29, 2015 14:26 — forked from sharang-webonise/webonise_cyberoam_login.sh
This script connects you to the internet through Cyberoam
Replace NAME with your username and PASS with your password that you use to connect to Cyberoam.
Now add this script to your your crontab like so:
$ crontab -e
Add the following entry:
* * * * * /home/webonise/.shell_scripts/cron_jobs/webonise_cyberoam_login.sh
Replace the path with wherever the above mentioned script lies on your system.
The script will be executed every minute. It will check if you are connected to the Internet and if not it will connect you.
@eliza-abraham
eliza-abraham / constructor.js
Created February 21, 2015 14:23
JavaScript Inheritance
// Constructors in prototypes
var Person = function(name) {
this.name = name;
}
var Student = function(name, university) {
// this.name = name // Wrong, no resusability;
// Person(name) // Wrong reference to this
Student.call(this, name);
@eliza-abraham
eliza-abraham / prototype_this.js
Last active August 29, 2015 14:15
JavaScript Prototype & this
/* Important concepts about prototypes and this */
// Problem Statement: console.log('hello'.repeatify(3)); Should print hellohellohello.
String.prototype.times = String.prototype.times || function(number) {
var str = '';
for (var i = 0; i < number; i++) {
str += this;
}
return str;
@eliza-abraham
eliza-abraham / hoisting.js
Created February 21, 2015 14:06
JavaScript Scopes & Hoisting
/* Scopes */
// Ex: 1
(function() {
var a = b = 5;
})();
console.log(b); // 5, b is global without var.
// Strict Mode
(function() {
@eliza-abraham
eliza-abraham / person_prototype.js
Last active August 29, 2015 14:15
Object Oriented Javascript : Prototypal Approach
// Prototypal Approach
var person = {
firstName: 'Anonymous',
lastName: 'Not Known',
create: function(firstName, lastName) {
self = Object.create(this);
self.firstName = firstName;
self.lastName = lastName;
@eliza-abraham
eliza-abraham / dog_class.js
Last active August 29, 2015 14:15
Object Oriented JavaScript : Classical Approach
// Classical Approach
var Dog = function(name, breed, age, origin){
this.name = name;
this.breed = breed;
this.age = age
this.origin = origin
this.bark = function() {
return('bow wow!');