Skip to content

Instantly share code, notes, and snippets.

View BlessYAHU's full-sized avatar
💻

A'braham Barakhyahu BlessYAHU

💻
View GitHub Profile
@BlessYAHU
BlessYAHU / exercise 2 - redux
Created October 19, 2010 18:01
Exercise 2
var countdown = (function() {
var index;
function log(){
console.log(index);
}
function iterate(){
log();
if(index>1) setTimeout(iterate, 1000);
@BlessYAHU
BlessYAHU / gist:636700
Created October 20, 2010 15:58
03-Skinning_cats
// Implement a number Prototype function for repeating strings.
// (4).times('test') --> 'testtesttesttest'
// Example in functional programming:
function repeatString(string, times){
var result = '';
while(times--) result += string;
return result;
}
@BlessYAHU
BlessYAHU / gist:636701
Created October 20, 2010 15:59
functional_vs_OO
// Exercise 1 - OO || !OO
// Define a data structure for cars (make and color), and a function
// that logs a string like "I'm a red Mercedes" to the console.
// Make two versions: a functional version, and a object-oriented version.
function logCar(params) {
if(params && params.color && params.make) {
console.log("I'm a " + params.color + " " + params.make );
}
}
@BlessYAHU
BlessYAHU / gist:636915
Created October 20, 2010 17:41
dom_events
<div id="the_div">
<ul id="the_list">
<li id="the_item">Click me!</li>
</ul>
</div>
<p id="log"></p>
<script type="text/javascript" charset="utf-8">
function log(string){
@BlessYAHU
BlessYAHU / DataController.cs
Created September 19, 2012 16:20
East Orientation in an MVC Action Result
public class DataController : Controller
{
public ActionResult Submit(string status)
{
var resultObject = new SomeViewModel();
_eastClass.PutStatus(status, fillResultObjectAction(resultObject);
return View(resultObject);
@BlessYAHU
BlessYAHU / whenyoucantcaptruehover.md
Created September 22, 2012 03:23
When You Can't Capture, Hover

When You Can't Capture, Hover(draft)

Even though the browser landscape in my line of work has gotten better (as in, projects don't use IE6 or IE7 anymore), I still need to deal with "legacy" browsers. Since IE8 has been around for ?? years and is becoming the [new IE6], the term legacy fits.

I came across an issue where it was taking some time for javascript objects to initialize after a page load on IE8 for an application I was building. I just read about delaying object initialization using event capturing to increase performance[link]. Makes sense, no need to initialize objects until they are about to be used. Of course the rub is that IE8 doesn't do event capturing. I could shake my fist at IE for being behind the times and the bane of web developer existence..but I chose to find another way to implement the concept.

The UI item in question was a an piece of a bigger UI element, and getting to it (to click it) required mousing over the containing UI element. I could use the mouseover event t

@BlessYAHU
BlessYAHU / index.html
Created September 24, 2012 19:20
[UPDATED!] showing another usage of input:checkbox. for full view: http://codepen.io/ImBobby/full/EdALB inspired from : http://designshack.net/design/notepad-to-do-list-psd
<div class="wrap">
<div class="header"><span>Todo List</span></div>
<div class="wrap-list">
<ol class="list">
<li>
<input type="checkbox" id="check-1" checked="checked">
<label for="check-1">Shop</label>
</li>
<li>
<input type="checkbox" id="check-2">
@BlessYAHU
BlessYAHU / gist:6644051
Last active December 23, 2015 13:39
Code has been changed to pseudocode, but intent is still there. Original code is using Underscore, fmap from drboolean's typeclasses library and autocurry from wu.js. Original code gets a list of filter commands and a list of products. Filter views are rendered only if products have properties matching filtercommand field names.
var lookupExecute = function( products, processCommands) {
this.commandArray = processCommands;
this.lookupArray = products;
};
// unwrapped values in functor, apply given function over each command object that has lookup items that meet the condition
lookupExecute.prototype.fmap = function(fn) {
var self = this,
mappedResults = map(this.commandArray, function(command) {
var matchedItems = self.lookupArray.filter(function(item) {
augmentProduct = function (findEmployee, carrierName, product) {
var view = this,
augmentedProduct = _.clone(product);
var augEmpRates = _.map(augmentedProduct.employeeRates, function (currRate) {
var augEmpRate = _.extend(currRate, { employee: {} });
return augEmpRate;
}
augmentedProduct.employeeRates = augEmpRates;

Keybase proof

I hereby claim:

  • I am blessyahu on github.
  • I am blessyahu (https://keybase.io/blessyahu) on keybase.
  • I have a public key ASChRzs5W0s3mhJSbSppYDPs2V65irh1RjAhU4z6kJdsvgo

To claim this, I am signing this object: