Skip to content

Instantly share code, notes, and snippets.

View caridy's full-sized avatar

Caridy Patiño caridy

  • Salesforce, Inc.
  • Miami, FL.
  • X @caridy
View GitHub Profile
// The plan
1. find the <script> pointing to yui(?:-(?:debug|min)).js -- this could be a combo file
2. Right after it, inject <script src="http://yui.yahooapis.com/(version)/build/io/io-base-min.js"></script> followed by a <script> pointing to your io override module.
- The static inclusion of io-base will add it to the YUI.Env.mods collection, preventing Loader from fetching the module
3. In your script, replace the YUI.Env.mods['io-base'] entry with your module's entry, and store off the existing io-base module entry under a different name. Specify this other name as a requirement for your module.
4. Profit (hopefully).
- YUI().use('whatever',...) should resolve dependencies, identifying your module as io-base, and requiring the real io-base be executed before yours (to facilitate proper overwriting)
/**
* Sanitize URL — Validate it looks like a URL, then make it less dirty.
*
* Oddnut Software
* Copyright (c) 2010 Eric Ferraiuolo - http://eric.ferraiuolo.name
* MIT License - http://www.opensource.org/licenses/mit-license.php
*
* Examples:
*
* 'Http://WWW.example.com/' » 'http://www.example.com/'
@isaacs
isaacs / bash.js
Created December 9, 2010 04:40
Someone build this for me, ok?
// find some-dir ... \
// | egrep 'o+$' \
// | sed -e 's|^foo|bar|' -e 's|^bar$|baz|g'
find("some-dir", {type:"file", older:new Date("January 12, 2010")})
.pipe(grep(/o+$/))
.pipe(sed([/^foo/, "bar"], [/^bar$/g, "baz"]))
.pipe(cat())
@davglass
davglass / gist:863055
Created March 9, 2011 21:35
Check out the new YUI docs
npm install selleck
git clone git://github.com/yui/yui3.git
cd yui3/src
selleck -s
http://localhost:3000/
@nzakas
nzakas / gist:880432
Created March 21, 2011 23:08
Get updates list before merging
# I was trying to figure out how to get a list of changes made remotely on Git
# before applying. Here's what I came up with.
# First, get the latest data from the origin
git fetch origin
# Then, get the changes and output to a file
git log HEAD..origin/master > changes.txt
# Merge changes in
@apipkin
apipkin / jquery-yui-widget.md
Created April 22, 2011 18:13
A comparison of the jQuery UI Widget Factory and the YUI 3 Widget class.

jQuery

Widget foo.js

(function($, undefined){
    
    $.widget('ui.foo', {
        
        options: {
@ericf
ericf / gist:961730
Created May 8, 2011 22:12
A simple, small, and powerful CSS Grid System (based on YUI 3 CSS Grids)
/* Based on YUI 3 CSS Grids: http://developer.yahoo.com/yui/3/cssgrids/ */
.layout {
letter-spacing: -0.31em; /* webkit: collapse white-space between units */
*letter-spacing: normal; /* reset IE < 8 */
word-spacing: -0.43em; /* IE < 8 && gecko: collapse white-space between units */
}
.layout > *,
.layout .unit {
display: inline-block;
zoom: 1; *display: inline; /* IE < 8: fake inline-block */
@benatkin
benatkin / Global.sublime-settings
Created July 20, 2011 04:26
excluding node_modules from Sublime Text 2
// Place user-specific overrides in this file, to ensure they're preserved
// when upgrading
{
"folder_exclude_patterns": [".svn", ".git", ".hg", "CVS", "node_modules"]
}
@nzakas
nzakas / anyword.js
Created July 23, 2011 19:33
"Any word" filter for YUI Autocomplete
/*
* Use the following in the "resultFilters" option when creating a YUI 3 Autocomplete
* widget. This will return matches when *any* of the words in the query string match.
* This is opposed to the default "wordMatch", which matches *all* words in the
* query string.
*/
function matchAnyWord(query, results) {
var WordBreak = Y.Text.WorkBreak,
@nzakas
nzakas / gist:1164118
Created August 23, 2011 01:47
Ant target for autogenerating changelog based on Git tags
<!--
Ant target for autogenerating a changelog based on Git tags
Workflow:
1. Do all of your checkins for a given version.
2. When you're ready to officially create a new version, tag it using git tag, such as "git tag v0.3.0".
3. If you don't already have a file named CHANGELOG in the root directory, make one.
4. Run "ant changelog.update"