Skip to content

Instantly share code, notes, and snippets.

View saltukalakus's full-sized avatar
🐢
Rust & Cryptography

saltukalakus

🐢
Rust & Cryptography
View GitHub Profile
@saltukalakus
saltukalakus / get_quertdtring_value.js
Created October 23, 2016 18:12
Helper to get a querystring value.
/*
* Helper to get a querystring value.
*/
function getParameterByName( name ){
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
@saltukalakus
saltukalakus / call.js
Created August 14, 2016 21:04
js call
var person = {
name: "James Smith",
hello: function(thing) {
console.log(this.name + " says hello " + thing);
}
}
person.hello.call(person, "world"); // output: "James Smith says hello world"
@saltukalakus
saltukalakus / call.js
Created August 14, 2016 21:02
js call
function personContainer() {
var person = {
name: "James Smith",
hello: function() {
console.log(this.name + " says hello " + arguments[1]);
}
}
person.hello.apply(person, arguments);
}
personContainer("world", "mars"); // output: "James Smith says hello mars", note: arguments[0] = "world" , arguments[1] = "mars"
@saltukalakus
saltukalakus / bind.js
Last active June 2, 2025 20:40
js bind
var person = {
name: "James Smith",
hello: function(thing) {
console.log(this.name + " says hello " + thing);
}
}
var helloFunc = person.hello.bind(person);
helloFunc("world"); // output: "James Smith says hello world"
@saltukalakus
saltukalakus / window.onload
Created August 9, 2016 14:10
js window on load page refresh trigger
window.onload = function() {
doSomethingElse();
};
@saltukalakus
saltukalakus / npm_view_old
Created August 7, 2016 15:14
npm view list old versions of a module
npm view module_name versions
@saltukalakus
saltukalakus / string_to_array
Created August 7, 2016 10:33
js, convert array to string with space
var arr = [1,2,3,4];
var res= arr.join(' ');
@saltukalakus
saltukalakus / function_overload.js
Last active June 2, 2025 20:40
Function overloading
test = require("tape");
function addMethod(object, name, fn){
object._store = object._store || {};
object._store[name] = object._store[name] || {};
object._store[name][fn.length] = fn;
object[name] = function() {
if(this._store[name][arguments.length])
return this._store[name][arguments.length].apply(this, arguments);
};
@saltukalakus
saltukalakus / module_pattern.js
Last active June 2, 2025 20:40
Structural patterns
test = require('tape');
// Basic module with closure
var Module = (function () {
var my = {},
privateVariable = 1;
function setPrivateMethod(val) {
privateVariable = val;
@saltukalakus
saltukalakus / README.md
Last active June 2, 2025 20:40
Technologies in the scope

List of things I am interested in web technologies. Not inclusive.

Database

  • MongoDB
  • ElasticSearch
  • Redis

Backend Libraries

  • ExpressJs
  • Mongoose