This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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 () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Scopes */ | |
// Ex: 1 | |
(function() { | |
var a = b = 5; | |
})(); | |
console.log(b); // 5, b is global without var. | |
// Strict Mode | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Prototypal Approach | |
var person = { | |
firstName: 'Anonymous', | |
lastName: 'Not Known', | |
create: function(firstName, lastName) { | |
self = Object.create(this); | |
self.firstName = firstName; | |
self.lastName = lastName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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!'); |
NewerOlder