Skip to content

Instantly share code, notes, and snippets.

View BlessYAHU's full-sized avatar
💻

A'braham Barakhyahu BlessYAHU

💻
View GitHub Profile
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@eligrey
eligrey / outerHTML.js
Created June 24, 2011 02:56
Efficient outerHTML polyfill that doesn't use cloneNode(true)
/*
* outerHTML.js
* Cross-browser full HTMLElement.outerHTML implementation.
*
* 2011-11-14
*
* By Eli Grey, http://eligrey.com
* Public Domain.
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
*/
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@adautoneto
adautoneto / WindsorContainerAdapter.cs
Created July 23, 2012 20:05
Twit: ServiceStack IContainerAdapter for Castle Windsor
internal sealed class WindsorContainerAdapter : IContainerAdapter
{
private readonly IWindsorContainer container;
public WindsorContainerAdapter(IWindsorContainer container)
{
this.container = container;
}
public T TryResolve<T>()
@max-mapper
max-mapper / readme.md
Created August 19, 2012 05:18
put-a-closure-on-it

Put a closure on it

Sometimes you'll have objects that manage state along with event handling. This happens frequently in MVC apps. Let's start with a messy example:

var Launcher = function(rocket) {
  this.rocket = rocket
}

Launcher.prototype.isReady = function() {

@cowboy
cowboy / isprimitive-no-strict.js
Created September 18, 2012 12:23
JavaScript: isPrimitive
var isPrimitive = function(val) {
return val !== function() { return this; }.call(val);
};
@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

@benfoster
benfoster / gist:3845201
Created October 6, 2012 15:22
MSpec Example 2
[Subject(typeof(Account))]
public class AccountSpecs
{
static Account account;
public class When_creating_a_new_account
{
Because of = ()
=> account = new Account();
@jordan-brough
jordan-brough / instructions.markdown
Created November 3, 2012 13:50
Splunk-friendly timestamp plugin snippet for Sublime Text 2
  1. Choose: Tools > New Plugin

  2. Paste in the contents of "timestamp.py" below

  3. Save as timestamp.py in ~/Library/Application Support/Sublime Text 2/Packages/User/ (should be the default directory that pops up when you save)

  4. Choose: Sublime Text 2 > Preferences > Key Bindings - User

  5. Add:

    { "keys": ["super+ctrl+t"], "command": "timestamp" }

To make command+ctrl+t perform the insertion.
Make sure to add a comma after the previous keymap entry, if present.

@nzakas
nzakas / gist:5511916
Created May 3, 2013 17:47
Using GitHub inside a company

I'm doing some research on how companies use GitHub Enterprise (or public GitHub) internally. If you can help out by answering a few questions, I'd greatly appreciate it.

  1. What is the primary setup? Is there an organization and each official repo is owned by that organization?
  2. Does every engineer have a fork of each repo they're working on?
  3. Are engineers allowed to push directly to the official repo? Or must all commits go through a pull request?
  4. Do engineers work on feature branches on the main repo or on their own forks?
  5. Do you require engineers to squash commits and rebase before merging?
  6. Overall, what is the workflow for getting a new commit into the main repository?
  7. What sort of hooks do you make use of?
  8. Are there any ops issues you encountered? (Scaling, unforeseen downtime, etc.)