git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| function JSON_stringify(s, emit_unicode) | |
| { | |
| var json = JSON.stringify(s); | |
| return emit_unicode ? json : json.replace(/[\u007f-\uffff]/g, | |
| function(c) { | |
| return '\\u'+('0000'+c.charCodeAt(0).toString(16)).slice(-4); | |
| } | |
| ); | |
| } |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| =begin | |
| http://marked2app.com | |
| Marked 2 preprocessor - "Lazy" footnotes. | |
| Allows use of `[^]` or `†` footnote references | |
| where the next [^]: or †: note defines the text of the footnote. |
| #!/usr/bin/env ruby | |
| # encoding: utf-8 | |
| # Marked 2 preprocessor | |
| # Allows use of `*` link references where the next [*]: href defines the link | |
| # Inspired by [tidbits][*] | |
| # [*]: http://tidbits.com | |
| if RUBY_VERSION.to_f > 1.8 | |
| input = STDIN.read.force_encoding('UTF-8') | |
| else | |
| input = STDIN.read |
| // modify/duplicate the other snippets in this group, using | |
| // the abbreviation to define words to replace with "swear" characters | |
| function censor (input) { | |
| var badWord = input.replace(/((er)?s?|ing)?$/, ''); | |
| return input.replace(badWord, censored(badWord)); | |
| } | |
| function shuffleArray(inputArr) { | |
| var array = inputArr.slice(0); |
| var smallWords = /^(a|an|and|as|at|but|by|en|for|if|in|nor|of|on|or|per|the|to|vs?\.?|via)$/i; | |
| return input.replace(/[A-Za-z0-9\u00C0-\u00FF]+[^\s-]*/g, function(match, index, title){ | |
| if (index > 0 && index + match.length !== title.length && | |
| match.search(smallWords) > -1 && title.charAt(index - 2) !== ":" && | |
| (title.charAt(index + match.length) !== '-' || title.charAt(index - 1) === '-') && | |
| title.charAt(index - 1).search(/[^\s-]/) < 0) { | |
| return match.toLowerCase(); | |
| } |
| <?php | |
| /* | |
| Copyright (c) 2012, Manu Manjunath | |
| All rights reserved. | |
| Redistribution and use of this program in source/binary forms, with or without modification are permitted. | |
| Link to this gist is preferred, but not a condition for redistribution/use. | |
| */ | |
| function mail_with_attachments($to, $subject, $message, Array $filepaths, $from = null, $replyto = null) { |
| <?php | |
| namespace WPSE; | |
| /** Plugin Name: Google JSAPI test plugin */ | |
| add_action( 'admin_enqueue_scripts', __NAMESPACE__.'\addScripts' ); | |
| function addScripts() | |
| { | |
| wp_enqueue_script( |
| // @SOURCE: https://stackoverflow.com/a/4673436/4864081 | |
| // First, checks if it isn't implemented yet. | |
| if (!String.prototype.format) { | |
| String.prototype.format = function() { | |
| var args = arguments; | |
| return this.replace(/{(\d+)}/g, function(match, number) { | |
| return typeof args[number] != 'undefined' | |
| ? args[number] | |
| : match |
git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
| function extend(target_object) { | |
| // Look for additional parameters in this function | |
| // eg. extend(target_object, ....a,b,c,d) | |
| if (!arguments[1]) { | |
| return; | |
| } | |
| // If any extra arguments, which are objects | |
| // loop through them | |
| for (var index = 1; index < arguments.length; index++) { |