This file contains 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 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 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 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 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 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 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 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 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
/* | |
Content Toggler | |
Show/hides content as specified in the target elements by data attribute | |
5/21/14 ~BV | |
The target elements must have the attribute "toggler" with a value | |
that is the selector of the content you want to show/hide when | |
the trigger is clicked. | |
Markup example: |
This file contains 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
<div class="overlay" tabindex="-1"></div> | |
.overlay { | |
@include opacity (70, .70); // enabled | |
z-index:998; // enabled | |
z-index: -1; | |
position: fixed; | |
left: 0; | |
top: 0; | |
width: 100%; |
OlderNewer