Skip to content

Instantly share code, notes, and snippets.

View demircancelebi's full-sized avatar

Demircan Celebi demircancelebi

View GitHub Profile
/*
M2WA 0.1.3 (Metrekare Web Application)
November 2013
@author Batuhan Icoz <[email protected]>
@author Demircan Celebi <[email protected]>
@license Proprietary. Check README.md
@component search
@desc This the main file for this component, this has router and the initializer
*/
var _ = require('underscore')
, Base = require('./base');
/**
* Takes a nested object and returns a shallow object keyed with the path names
* e.g. { "level1.level2": "value" }
*
* @param {Object} Nested object e.g. { level1: { level2: 'value' } }
* @return {Object} Shallow object with path names e.g. { 'level1.level2': 'value' }
*/
@demircancelebi
demircancelebi / dabblet.css
Created April 17, 2015 02:55
How to make 3-corner-rounded triangle in CSS (SO)
/**
* How to make 3-corner-rounded triangle in CSS (SO)
* http://stackoverflow.com/q/14446677/1397351
*/
.triangle {
position: relative;
background-color: orange;
text-align: left;
}
.triangle:before,
@demircancelebi
demircancelebi / reset.js
Created July 9, 2015 00:57
node.js modem reset
/*
Usage:
You should allow telnet in modem settings beforehand (might be allowed already)
You should set opts according to your modem settings
loginText = When you try `telnet 192.168.2.1` in terminal
it asks you login name for the modem. Change
this text to something you see on that line.
I saw my modem name and used that.
@demircancelebi
demircancelebi / styles.less
Last active February 4, 2016 11:58
atom retina fix - I am using Spacegray Dark Theme but the code should be a starting point for other themes as well
atom-text-editor {
font-size: 24px;
}
.tab-bar {
height: 60px;
.tab {
padding-right: 48px;
max-width: 350px;
@demircancelebi
demircancelebi / xmlToJson.js
Last active September 1, 2023 12:40 — forked from chinchang/xmlToJson.js
Function to convert XML to JSON
// Changes XML to JSON
// Modified version from here: http://davidwalsh.name/convert-xml-json
xmlToJson(xml) {
// Create the return object
let obj = {};
if (xml.nodeType === 1) { // element
// do attributes
if (xml.attributes.length > 0) {
obj['@attributes'] = {};

Keybase proof

I hereby claim:

  • I am demircancelebi on github.
  • I am demircancelebi (https://keybase.io/demircancelebi) on keybase.
  • I have a public key ASAM2f5feSRL1jvGDD39jpnLezV7aVGzm3RlIzR26VChXQo

To claim this, I am signing this object:

@demircancelebi
demircancelebi / index.js
Created February 4, 2020 20:22
K-Armed Bandit
const ARMS = 10;
const STEPS = 100000;
const means = [];
const epsilons = [0, 0.01, 0.1];
let rewards = [];
let pulls = [];
for (let i = 0; i < ARMS; i++) {
means.push(Math.random() * 6 - 3);
rewards.push(0);