Skip to content

Instantly share code, notes, and snippets.

View bhalash's full-sized avatar
💭
🌈

Mark bhalash

💭
🌈
View GitHub Profile
@bhalash
bhalash / instasort.sh
Created June 21, 2016 08:45
Sort Dropbox-uploaded photographs
#!/usr/bin/env zsh
#
# Functions
#
#
# Check if Photograph is Square
#
@bhalash
bhalash / add_locale_string.rb
Last active June 6, 2016 15:27
Add Locale Strings
#!/usr/bin/env ruby
require 'yaml'
#
# Consts
#
PROG_VERSION = '1.0.0'
PROG_NAME = 'add_locale_string'
@bhalash
bhalash / fizzbuzz.js
Created May 25, 2016 16:41
Recursive JavaScript Fizzbuzz
(function fizzbuzz(number, max) {
var fizz = '';
number = number || 1;
max = max || 100;
if (!(number % 5)) {
fizz += 'fizz';
}
### Keybase proof
I hereby claim:
* I am bhalash on github.
* I am bhalash (https://keybase.io/bhalash) on keybase.
* I have a public key whose fingerprint is 865A D7F1 E2EA F5C7 F5B0 3883 E757 1B1D DDDE 23C3
To claim this, I am signing this object:
@bhalash
bhalash / bindings.js
Last active May 15, 2016 22:48
jQuery-based data binding directives
(function($, document, window) {
/**
* Event subscribe/unsubscribe.
*
* @link https://davidwalsh.name/pubsub-javascript
* @link https://gist.github.com/cowboy/661855
*/
$.observer = $({});
@bhalash
bhalash / recursive_sort.js
Last active June 12, 2016 16:19
Recursive Sort
#!/usr/bin/env node
var sorter = function(a, b) {
if (a < b) {
return -1;
}
if (b == a) {
return 0;
}
@bhalash
bhalash / events_pub_sub.js
Last active May 4, 2016 13:39
Super-simple explanation of jQuery's pub/sub model
/**
* Super-duper simple explanation of jQuery's pub/sub model.
* See: https://gist.github.com/cowboy/661855
* See: https://github.com/cowboy/jquery-tiny-pubsub
*/
/*
* 1. Pass DOM element to jQuery and save the instance as a variable.
*/
@bhalash
bhalash / lightbox.js
Created April 27, 2016 21:09
Old lightbox
// Gallery, row, and img classes.
// UPDATE GALLERY.CSS IF YOU CHANGE THESE!!!!
var customClass = '.funcan';
var galleryClass = customClass + '-gallery';
var rowClass = customClass + '-row';
var lightboxClass = customClass + '-lightbox';
// Lightbox div elements.
var lightboxElements = [
lightboxClass + '-close',
lightboxClass + '-nav',
@bhalash
bhalash / index.html
Created April 26, 2016 20:55
Observers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Observer Test</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<table id="people">
<thead>
@bhalash
bhalash / CompareDate.java
Created April 23, 2016 14:08
Date comparison
import java.text.SimpleDateFormat;
import java.util.Date;
public class AskDate {
public static void main(String args[]) {
Date today = new Date();
Date birthday = stringToDate("May 8, 1981");
// Date birthday = stringToDate("April 23, 2016");
System.out.println(today);