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
var longString = "This is a long string."; | |
var iterations = 1000000; | |
var timer = new Stopwatch(); | |
"\nTake()".Dump(); | |
timer.Start(); | |
for (int i = 0; i < iterations; i++) { | |
var newString = new string(longString.Take(10).ToArray()); | |
if (i == 0) newString.Dump(); | |
} |
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
<script>console.log("xss");</script> |
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
// ======================= | |
// = WRAP IMAGES IN DIVS = | |
// ======================= | |
function wrapImagesInDiv($content) { | |
$pattern = '/(<img[^>]*class=\"([^>]*?)\"[^>]*>)/i'; | |
$replacement = '<div class="image-container $2">$1</div>'; | |
$content = preg_replace($pattern, $replacement, $content); | |
return $content; | |
} |
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 URLtoData($html) { | |
$imgTags = null; | |
preg_match_all("/<img.*?>/", $html, $imgTags); | |
foreach ($imgTags[0] as $imgTag) { | |
$src = null; | |
preg_match_all("/src=\"([^\"]*)/", $imgTag, $src); | |
$src = $src[1][0]; | |
$data = base64_encode(file_get_contents($src)); |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>author</key> | |
<string>Michael Sheets</string> | |
<key>name</key> | |
<string>Twilight</string> | |
<key>settings</key> | |
<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
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Twilight-HAG.tmTheme", | |
"font_face": "Consolas", | |
"font_size": 10, | |
"ignored_packages": | |
[ | |
"Vintage" | |
], | |
"theme": "Soda Dark.sublime-theme", |
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
add_filter( 'parse_query', 'exclude_pages_from_admin' ); | |
function exclude_pages_from_admin($query) { | |
global $pagenow, $post_type; | |
if (is_admin() && $pagenow=='edit.php' && $post_type =='page') { | |
$query->query_vars['post__not_in'] = array(2, 71); | |
} | |
} |