Skip to content

Instantly share code, notes, and snippets.

View hongymagic's full-sized avatar
🤪

David Hong hongymagic

🤪
View GitHub Profile
@freeranger
freeranger / JSHintFailures.js
Last active August 29, 2015 13:57
JSHint failures that don't all show up in TeamCity Reporter
var noSemiColon = 'noSemiColon';
window.alert(noSemiColon)
if (noSemiColon == "must use single quotes") {
window.alert('this was a test for single quotes');
}
// ahould have curly braces
@stevenharman
stevenharman / Iso8601DateTimeBinder.cs
Created November 2, 2010 19:25
an asp.net-mvc Model Binder that respects the ISO 8601 standard. look it up, yo!
using System;
using System.Globalization;
using System.Web.Mvc;
namespace Zomg.Web.ModelBinders
{
public class Iso8601DateTimeBinder : DefaultModelBinder
{
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
@WebReflection
WebReflection / Object.prototype.in.js
Created August 20, 2011 08:32
implementing "in" operator as generic object method
(function(Object, String){
// (C) WebReflection - Mit Style License
// @about implementing "in" operator as generic object method
// returns primitive value or object itself
function toValue(obj) {
switch (true) {
case isInstanceOf(obj, Boolean):
case isInstanceOf(obj, Number):
@claco
claco / gist:1888612
Created February 23, 2012 00:17
Pomodoro on Alfred
on alfred_script(q)
tell application "Pomodoro"
if q is equal to "reset" then
reset
else if q is equal to "resume" then
resume
else if q is equal to "complete" then
force completion
else if q is equal to "external" then
Copyright (c) 2011 Kir Belevich, http://soulshine.in
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@hongymagic
hongymagic / pr.md
Last active December 15, 2017 09:50 — forked from piscisaureus/pr.md
Checkout pull-requests from Atlassian Stash without adding remote

Locate the section for your stash remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@stash.internal:private/repository.git

Now add the line fetch = +refs/pull-requests/*:refs/remotes/origin/pull-requests/* to this section. Obviously, change the stash url to match your project's URL. It ends up looking like this:

@Olical
Olical / Documentation.md
Created September 22, 2011 12:07
Preloader.js - Preload all assets, ideally for a game, using MooTools

About

This class allows you to preload all of your images, sounds, videos, JSON, JavaScript and CSS files with one call. It provides you with progress reports and lets you know when everything is done.

It requires MooTools and MooTools More with the Assets and Request.JSONP boxes ticked. I have attached a copy of the required MooTools More version to this gist.

Example

You can find an example here on jsFiddle.

@neilj
neilj / gist:1532562
Created December 29, 2011 07:22
Sugared DOM: Better Than Templates
var el = ( function () {
var doc = document;
var directProperties = {
'class': 'className',
className: 'className',
defaultValue: 'defaultValue',
'for': 'htmlFor',
html: 'innerHTML',
@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"
@CMCDragonkai
CMCDragonkai / angularjs_directive_attribute_explanation.md
Last active November 29, 2023 15:35
JS: AngularJS Directive Attribute Binding Explanation

AngularJS Directive Attribute Binding Explanation

When using directives, you often need to pass parameters to the directive. This can be done in several ways. The first 3 can be used whether scope is true or false. This is still a WIP, so validate for yourself.

  1. Raw Attribute Strings

    <div my-directive="some string" another-param="another string"></div>