Skip to content

Instantly share code, notes, and snippets.

View bmvakili's full-sized avatar

Bijan Vakili bmvakili

View GitHub Profile
@bmvakili
bmvakili / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@bmvakili
bmvakili / handlebarexample.json
Last active August 29, 2015 14:13
handlebar example json
[
{
"errors" : "",
"numDashboards" : 3,
"dashboard" :
[ {
"id" : 0,
"name" : "costs",
"numCharts" : 1,
"chart" : [
@bmvakili
bmvakili / handlebarexample.js
Created January 22, 2015 04:40
handlebar example js
$(document).ready(function() {
var source = null;
var activeDashboardId = 0;
render = function() {
$.getJSON(
'/edens_group/test/list',
function(data) {
console.log(data);
for(datum of data) {
console.log("Num Dashboards: " + datum.numDashboards);
@bmvakili
bmvakili / handlebarjsexamplecontent.handlebars
Created January 22, 2015 04:38
handlebar example content handle
<h1 class="page-title">{{page_title}}</h1>
<ul>
{{#each dashboard}}
{{dashboard_link}}
{{/each}}
</ul>
<div id='dashboard-wrapper'>
{{#each dashboard}}
@bmvakili
bmvakili / handlebarexample.css
Created January 22, 2015 04:37
handlebar example css
section#body-section #dashboard-wrapper {
width: 97%;
display: block;
margin-left: auto;
margin-right: auto;
border: dashed black 1px;
padding: 1em;
}
@bmvakili
bmvakili / partialbinarysearchtree.js
Last active August 29, 2015 14:13
Partial Binary Search Tree and Node implementation
/**
* Partial Binary Search Tree class.
* @author Bijan Vakili
*/
var Node = function() {
// Private variable to access 'this' context from privileged method
var that = this;
// Public variables
@bmvakili
bmvakili / checkerboard.css
Last active August 29, 2015 14:13
25x25 checker board css
.box-wrapper {
width: 250px;
height: 250px;
}
.box-wrapper > .box{
background: #000;
width: 8px;
height: 8px;
float: left;
@bmvakili
bmvakili / checkerboard.js
Created January 21, 2015 20:15
25x25 checker board javascript
/**
* Create 25x25 checker board and add hover and click listeners.
* Hovering should cross-hair column and row-wise boxes.
* Clicking should toggle box color to red.
* Clicking back space should reset colors to default.
* @author Bijan Vakili
*/
$( document ).ready( function() {
var efficientContainer = '#result-efficient',
@bmvakili
bmvakili / table.js
Created January 20, 2015 20:00
table
function jsonTable() {
var data = {
headers: ["First Name", "Last Name", "Age"],
rows: [
["John", "Doe", 30],
["Jane", "Doe", 27],
["Mac", "Smith", 52]
]
};
@bmvakili
bmvakili / jssetintersection.js
Last active August 29, 2015 14:13
Set with intersection
/**
* Set intersect
* The algorithm is provided by Ophir LOJKINE. I modified it to work for sets.
* @author Ophir LOJKINE
* https://gist.github.com/lovasoa/3361645
* @author Bijan Vakili
*/
Set.prototype.intersect = function() {
var i, all, shortest, nShortest, n, len, ret = [], obj={}, nOthers;
arguments[arguments.length++] = this;