Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Yönet Yonet

🎯
Focusing
View GitHub Profile
View .block
license: mit
View .block
license: mit
@Yonet
Yonet / introrx.md
Last active Sep 11, 2016 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
View introrx.md
View Froyo.html
<html>
<head>
<title>Froyo Machine!</title>
<style>
#machine {
float:left;
width:40%;
border:3px outset gray;
}
div#power > img {
@Yonet
Yonet / gist:fd79a36c61fc27518cae
Created Jul 12, 2015
Implementation of sqRoot
View gist:fd79a36c61fc27518cae
var sqRoot = function(n){
var upper = n;
var lower = 1;
var results = [1];
var search = function(){
var mid = Math.floor((upper + lower) /2);
var current = mid * mid;
View chairs
var chairs = {
totalNodes: 1,
nodes: {1:{next: null, prev: null, val: 1}},
addNextNode: addNextNode,
removeNode: removeNode
}
function removeNode(node){
node.prev.next = node.next;
node.next.prev = node.prev;
View flat.js
var flatten = function(obj, cKey, returnObj) {
result = returnObj || {};
for(var key in obj) {
var newKey = cKey ? cKey + '.'+ key : key;
if(!(obj[key] instanceof Object)) {
result[newKey] = obj[key];
}
else if (obj[key] instanceof Object){
flatten(obj[key], newKey, result);
}
View gist:4f3f05f18ca479561580
//given an array of integers (x), and an integer (y), returns true if any two of the integers in x add up to y.
var addsToY = function(arr, y) {
for(var i = 0; i < arr.length; i ++) {
for (var j = i + 1; j < arr.length; j++) {
if(arr[i] + arr[j] === y) return true;
}
}
return false;
}
View Fast solution
var shufflin = function (n, c) {
var deck;
var count = 1;
//array to hold the frequency of the cards appearing in the same index
var frequency = new Array(n);
//creates a deck with n values
var createDeck = function (n) {
var arr = [];
for (var i = 0; i< n; i++) {