Skip to content

Instantly share code, notes, and snippets.

View Yonet's full-sized avatar
🎯
Focusing

Yönet Yonet

🎯
Focusing
View GitHub Profile
@Yonet
Yonet / men.JSON
Created September 10, 2013 04:07 — forked from krgeppert/men.JSON
[{"id":"0m","hotness":0.591468543279916,"rankings":[{"id":"21w","hotness":0.17892177822068334},{"id":"26w","hotness":0.35050580697134137},{"id":"41w","hotness":0.2367910670582205},{"id":"22w","hotness":0.3154465176630765},{"id":"35w","hotness":0.033567901235073805},{"id":"15w","hotness":0.25578767503611743},{"id":"37w","hotness":0.09405278996564448},{"id":"40w","hotness":0.2901887996122241},{"id":"18w","hotness":0.07633938547223806},{"id":"7w","hotness":0.13957931869663298},{"id":"43w","hotness":0.08935506152920425},{"id":"6w","hotness":0.44330935273319483},{"id":"1w","hotness":0.3342087329365313},{"id":"44w","hotness":0.3334620089735836},{"id":"11w","hotness":0.7703214744105935},{"id":"12w","hotness":0.25622058450244367},{"id":"0w","hotness":0.22968668141402304},{"id":"30w","hotness":0.2678251701872796},{"id":"17w","hotness":0.21898658387362957},{"id":"48w","hotness":0.43219820223748684},{"id":"38w","hotness":0.23681716341525316},{"id":"25w","hotness":0.3409113010857254},{"id":"23w","hotness":0.2041905778460
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++) {
//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;
}
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);
}
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;
@Yonet
Yonet / gist:fd79a36c61fc27518cae
Created July 12, 2015 04:23
Implementation of sqRoot
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;
<html>
<head>
<title>Froyo Machine!</title>
<style>
#machine {
float:left;
width:40%;
border:3px outset gray;
}
div#power > img {
@Yonet
Yonet / introrx.md
Last active September 11, 2016 23:01 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@Yonet
Yonet / .block
Created September 18, 2016 20:35
Wars II
license: mit
@Yonet
Yonet / .block
Created September 18, 2016 20:36
Wars II
license: mit