Skip to content

Instantly share code, notes, and snippets.

View bhalash's full-sized avatar
💭
🌈

Mark bhalash

💭
🌈
  • Ireland
View GitHub Profile
@bhalash
bhalash / .tigrc
Last active March 10, 2016 12:21
.tigrc
# See: http://www.calmar.ws/vim/256-xterm-24bit-rgb-color-chart.html
# See: http://jonas.nitro.dk/tig/tigrc.5.html
#
# Area Foreground Background Options
# ==============================================================================
# Main UI
# ==============================================================================
color default 250 234
color 'Author ' 15 default
@bhalash
bhalash / evil_string.rb
Last active January 21, 2016 20:57
Ruby regex test
#! /usr/bin/env ruby
# http://rubular.com/r/2Z6twnqiB7
# http://rubyfiddle.com/riddles/d4d27
only_letters_regex = /^[A-Za-z]+$/
evil_string = 'Good
123456789
"1" = "1"))/*
@bhalash
bhalash / functions.php
Last active March 20, 2016 20:56
WordPress post content content replacement
add_filter('the_content', function($content) {
$bindings = [
'<img' => ['click: lightbox.show']
];
foreach ($bindings as $tag => $directives) {
$directive = sprintf('%s data-bind="%s" ', $tag, implode(', ', $directives));
$content = str_replace($tag, $directive, $content);
// <img data-bind="click: lightbox.show"
@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);
@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 / 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 / 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 / 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 / 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 = $({});
### 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: