Skip to content

Instantly share code, notes, and snippets.

View iwill's full-sized avatar
Growing Well 🌱🌱

Míng iwill

Growing Well 🌱🌱
View GitHub Profile
@iwill
iwill / jquery.and.js
Last active September 4, 2015 12:14
$.fn.and
/*!
* jQuery plugin - jquery.and.js v1.1
* http://github.com/iwill/
*/
(function($) {
$.fn.and = function(selector, context) {
return $.merge(this.pushStack(this), $(selector, context));
};
})(jQuery);
@iwill
iwill / jquery.addEventType.js
Last active September 4, 2015 12:14
$.addEventType & $.fn.addEventType
/*!
* jQuery plugin - jquery.addEventType.js v1.0
* http://github.com/iwill/
*/
(function($) {
$.addEventType = $.fn.addEventType = function(eventType) {
(this.fn || this)[eventType] = function(handler) {
return handler ? this.bind(eventType, handler) : this.trigger(eventType);
};
return this;
@iwill
iwill / UIColor+.h
Created May 5, 2011 17:30
Objective-C UIColor - inverseColor
//
// UIColor+.h
// iTest
//
// Created by iwill on 11-03-09.
// Copyright 2011 iwill. All rights reserved.
//
#import <Foundation/Foundation.h>
@iwill
iwill / $class-2.0.0.js
Last active September 21, 2023 08:16
$class-2.0.0
/*!
* Javascript library - $class 2.0.0
* https://gist.github.com/iwill/2303057
*/
export default function $class(source, SuperClass) {
// default values
SuperClass = SuperClass || Object;
source = source || {};
// constructor & super constructor
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
@iwill
iwill / nodejs.sh
Last active October 12, 2015 15:28
JSON Parsing and Editing, run Javascript Function and Statements in Shell via Node.js
#!/bin/bash
# @see https://www.npmjs.org/package/json
## nodejs [js-statement ...] js-expression
function nodejs() {
local statements=""
while [[ $# > 1 ]]; do
statements="${statements:+$statements; }$1"
shift
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
@iwill
iwill / repeat.sh
Created April 8, 2013 14:08
repeat for bash like csh repeat
#! /bin/bash
function repeat() {
if [[ $# < 2 ]]; then
echo "repeat: Too few arguments."
return 1
else
n=$1
shift
seq $n | xargs -I{} "$@"
@iwill
iwill / which-and.sh
Last active December 15, 2015 23:50
wa mate xx.sh = which xx.sh | xargs mate
# which and
function wa() {
which "$2" | xargs "$1"
}
export -f wa
# which and mate
function wamate() {
wa mate "$1"
}
@iwill
iwill / Objective-C Code Snippt
Created April 15, 2013 15:25
Objective-C Code Snippt
[method]
mm
[<#object#> <#method#>]
{block}
bb
[<#object#> <#method#>]
#pragma mark -
pp