Skip to content

Instantly share code, notes, and snippets.

View Kjaer's full-sized avatar
👷‍♂️
Code Janitor

Halil Kayer Kjaer

👷‍♂️
Code Janitor
View GitHub Profile
@Kjaer
Kjaer / app.js
Last active August 29, 2015 14:09
Angular.js Divide List with ng-repeat
var myApp = angular.module('myApp', []);
myApp.controller('MyCtrl', function ($scope) {
$scope.parts = [{"Id":7204, "Name":"Air Cleaner", "ProductCount":3452},
{"Id":7205, "Name":"Battery", "ProductCount":76},
{"Id":7206, "Name":"Choke", "ProductCount":342},
{"Id":7207, "Name":"Clutch Lever", "ProductCount":98},
{"Id":7208, "Name":"Crankcase Cover", "ProductCount":0},
{"Id":7209, "Name":"Crash Bar", "ProductCount":456},
{"Id":7210, "Name":"Cylinder", "ProductCount":184},
(function (w, d, s) {
function go() {
var js,
fjs = d.getElementsByTagName(s)[0],
load = function (url, id) {
if (d.getElementById(id)) { return; }
js = d.createElement(s);
js.src = url;
js.id = id;
fjs.parentNode.insertBefore(js, fjs);
This is the javascript regular expression to check password meet the reqirements.
Here it is :
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$-/ | :-? | {-~ | ! | @ | # | " | ^ | _ |` | \[ | \]])[a-zA-Z0-9$-/:-?{-~!@#"^_`\[\]]{8,16}/g
(?=.*[a-z]) means should include lowercase letter
(?=.*[A-Z]) means should include uppercase letter
(?=.*[0-9]) means should include number
(?=.*[$-/ | :-? | {-~ | ! | @ | # | " | ^ | _ |` | \[ | \]]) means should include symbol
@Kjaer
Kjaer / any_view.html
Created November 13, 2017 07:36
knockout String Template solution.
<!-- plyr binding usage -->
<div class="video-player-container" data-bind="plyr:{videos:playerData.videos,cover:playerData.cover, instance:playerData.instance}"></div>
@Kjaer
Kjaer / filter.js
Created November 19, 2017 06:54 — forked from vpalos/filter.js
JS: A simple search function designed for filtering large lists of strings.
/**
* Demo: http://vpalos.com/sandbox/filter.js/
*
* A generic search algorithm designed for filtering (very) large lists of strings; when an input string
* contains all the parts (words or characters; whitespace is ignored) of the query, spread-out over the text
* then the string is considered to be a match. It works with the way internet browsers (e.g. Firefox, Google
* Chrome) filter address-bar suggestions on user input. It is also quite fast; on my i7 laptop, filtering
* 1) a list of ~23000 items takes around 50ms (yes, milliseconds!);
* 2) a list of ~1 million text items took under 1 second.
* It works both in NodeJS as well as in browser environments (so far I only tested FF and GC).
@Kjaer
Kjaer / HashTable.js
Created November 19, 2017 20:21 — forked from alexhawkins/HashTable.js
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@Kjaer
Kjaer / Remote_responsejson
Last active December 15, 2017 08:58
Data Model Example
"questions": [
{
"question_type": "multiple-choice",
"identifier": "ac9835eb-9efa-4cce-9e35-09987d32e6c8",
"headline": "Multiple Choice Question Sentence 1",
"description": null,
"required": false,
"multiple": true,
"choices": [
{
@Kjaer
Kjaer / .gitconfig
Last active September 15, 2023 11:34 — forked from salimkayabasi/.gitconfig
# credit: http://haacked.com/archive/2014/07/28/github-flow-aliases/
[user]
name = Halil Kayer
email = kayer.halil@gmail.com
signingkey = 60C52C88E94A6EB1
[core]
editor = micro
pager = delta
excludesfiles = /Users/u132515/.gitignore
[commit]

ARCH OVERVIEW

COMPONENTS

CENTER
  • has many clusters.
  • passes down the minimum and maximum server count
  • passes down available apps for the cluster

CLUSTER

@Kjaer
Kjaer / algo.js
Last active April 8, 2019 10:23
find longest same char
/*
Algorithmic task
Given a string of length 1048576,
find the position of the longest substring made from identical characters.
It is guaranteed that there is only one such substring and its length is 8192.
You are not allowed to peek inside the string, however you can call an external
function "getMaxLength(int startPosition, int endPosition)" which will return
the longest number of identical consecutive characters found within the interval.