Skip to content

Instantly share code, notes, and snippets.

@binary10ve
binary10ve / template.js
Created February 3, 2014 10:46
Class for creating Html chunks on the fly
function Template( html, object_s ){
this.html = html,
this.object_s = object_s,
this.parser = function( obj ){
var html = this.html;
for( var i in obj ){
// Create a regex out of object key and replace it with their values
var reg = new RegExp( "\{" + i + "\}" , "g" );
var html = html.replace( reg, obj[i] );
}
@binary10ve
binary10ve / list.js
Created April 23, 2016 19:25
List ADT
function List(){
this.listSize = 0;
this.pos = 0;
this.data = [];
}
List.prototype = {
toString : function(){
return this.data.toString();
{
"name": "Jacob Padilla",
"root": true,
"children": [
{
"name": "Julian Maxwell",
"children": [
{
"name": "Jose Ross",
"children": [
@binary10ve
binary10ve / index.html
Last active August 7, 2016 16:38
Network graph
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Orbit Layout Modes</title>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<style>
body, html {
width: 100%;
margin: 0;
font-family: "Helvetica Neue", Helvetica, sans-serif;
@binary10ve
binary10ve / introrx.md
Created October 10, 2016 09:11 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@binary10ve
binary10ve / Insertion-sort
Last active May 9, 2017 04:06
Insertion Sort
/*
InsertionSort(A, n){
for i <- 1 to n-1
value = A[i-1]
j = i-1;
while( j > -1 & A[j] > value)
A[j+1] = A[j]
j--
A[j+1] = value
function LinkedList(){
this.head = null;
}
LinkedList.prototype.append = function(data){
var newNode = {
data : data,
next : this.head // Since the new node is going to be the head, assigning existing head reference to next property
}
this.head = newNode;
@binary10ve
binary10ve / python_decorator_guide.md
Created October 17, 2017 20:49 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@binary10ve
binary10ve / redis_cheatsheet.bash
Created November 9, 2017 12:40 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@binary10ve
binary10ve / adapter.py
Created November 10, 2017 13:40 — forked from pazdera/adapter.py
Example of `adapter' design pattern in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Example of `adapter' design pattern
# Copyright (C) 2011 Radek Pazdera
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.