This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| My Plugin | |
| The description/summary of the plugin | |
| 5/21/14 ~BV | |
| Syntax: | |
| $(selector).myPlugin(options) | |
| Usage: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery(function($){ | |
| function debug(str) { | |
| if (settings.debug) { console.log(str); } | |
| } | |
| var settings = { | |
| debug: true | |
| } | |
| var root = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Get HTML from an element, then escape it and drop it into another element (pre) | |
| function viewsource(sel) { | |
| var source = document.getElementById(sel).innerHTML; | |
| source = source.replace(/[<>]/g, function(m) { return {'<':'<','>':'>'}[m]}); | |
| source = source.replace(/((ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?)/gi,'<a href="$1">$1</a>'); | |
| document.getElementById("source").innerHTML = source; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SASS | |
| @function pxtoem($pixels, $context: 16) { | |
| @return #{$pixels/$context}em | |
| } | |
| // USE | |
| .element { | |
| max-width: pxtoem(780); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <style> | |
| .arrowme:after { | |
| position: absolute; | |
| display: inline-block; | |
| content: ''; | |
| margin-left: 10px; | |
| border-top: 6px solid transparent; | |
| border-bottom: 6px solid transparent; | |
| border-left: 6px solid #000; | |
| margin-top: 9px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $bbcode = file_get_contents("bbcode.txt"); | |
| function bbcodeToHtml($str, $convertBreaks=true) { | |
| $replace = array( | |
| // bold | |
| array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ytEmbed($str) { | |
| $pattern = '/https?:\/\/(?:[0-9A-Z-]+\.)?(?:youtu\.be\/|youtube\.com(?:\/embed\/|\/v\/|\/watch\?v=|\/ytscreeningroom\?v=|\/feeds\/api\/videos\/|\/user\S*[^\w\-\s]|\S*[^\w\-\s]))([\w\-]{11})[?=&+%\w-]*/i'; | |
| $found = preg_match_all($pattern, $str, $matches); | |
| if ($found > 0) { | |
| foreach ($matches[0] as $k => $replaceThis) { | |
| $ytid = $matches[1][$k]; | |
| $replaceWith = '<div class="media"><div class="video-container"><iframe title="YouTube video" class="youtube-player" height="315" width="560" type="text/html" src="http://www.youtube.com/embed/'.$ytid.'" frameborder="0"></iframe></div></div>'; | |
| $str = str_replace($replaceThis, $replaceWith, $str); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <pre> | |
| <? | |
| class ImageShack { | |
| function auth($username, $password) { | |
| $this->debug("Logging in"); | |
| $response = $this->doCurl("post", "https://api.imageshack.us/v1/user/login", array( | |
| "user" => $username, | |
| "password" => $password |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Works well on most current popular browsers. (Web fonts shakey on fringe browsers) | |
| .styled-input { | |
| input[type=radio] { | |
| display: none; | |
| &:checked + label:before { | |
| @include icon($icon-radio-checked); | |
| color: #000; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var typeahead = { | |
| timer: false, | |
| start: function(input) { | |
| _debug(".typeahead keyup"); | |
| // Unset any started timers from previous keyup | |
| if (typeahead.timer != undefined) { | |
| clearTimeout(typeahead.timer); | |
| } |