A Pen by Marius Balaj on CodePen.
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
| Huffington Post Canada bingo Facebook post: | |
| <div id="fb-root"></div><script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script><div class="fb-post" data-href="https://www.facebook.com/HuffPostCanada/posts/978107295542783:0" data-width="500"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/HuffPostCanada/posts/978107295542783:0"><p>Play along at home if you're watching tonight's Maclean's debate</p>Posted by <a href="https://www.facebook.com/HuffPostCanada">The Huffington Post Canada</a> on <a href="https://www.facebook.com/HuffPostCanada/posts/978107295542783:0">Thursday, August 6, 2015</a></blockquote></div></div> | |
| Vox.com's explainer on the 2015 Canadian election: | |
| http://www.vox.com/2015/8/6/9109669/2015-canada-fed |
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 | |
| define('FOLDER_CLEANUP', '/Users/rdmdev/Downloads/temp'); | |
| $files = scandir(FOLDER_CLEANUP); | |
| foreach ($files as $file) { | |
| $wanted = explode("_", $file); | |
| if (strpos($files[array_search($file, $files) + 6], $wanted[1])) | |
| { | |
| //unlink(FOLDER_CLEANUP . "/" . $file); | |
| echo "Deleting: " . FOLDER_CLEANUP . "/" . $file . "\n"; |
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 if ( is_home() ): ?> | |
| <div id="ad_sliver" class="sliver"> | |
| <script> adUtility.insertAd("ad_sliver", { type: adUtility._AD_SLIVER }); </script> | |
| </div> | |
| <?php else: ?> | |
| <div id="ad_sliver" class="sliver"> | |
| <script>if ( window.snBreakpointWatcher.breakPoint() >= 1024 ) { adUtility.insertAd("ad_sliver", { type: adUtility._AD_SLIVER }); }</script> | |
| </div> | |
| <?php endif; ?> |
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
| <!-- Loyalty mobile warning --> | |
| <script> | |
| $(document).ready(function() { | |
| var isMobile = window.matchMedia("only screen and (max-width: 760px)"); | |
| var isCookieSet = getCookie('loyalty_mobile_warning'); | |
| if (isMobile.matches && isCookieSet === false) { | |
| setCookie('loyalty_mobile_warning', '1', 2); | |
| alert("The 680 NEWS Insider Club is optimized to work best on a computer or tablet. Please log in using one of those devices. If you are on a smartphone, rotate it to landscape mode.") | |
| } | |
| }); |
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
| // If the query parameter is passed, use a different article template than the usual | |
| // (this one has no header/footer). | |
| function rssa_content_mobile_view() { | |
| if ( isset( $_GET['rssa'] ) && is_singular() ) { | |
| require '/some-path/article/view.article.mobile-view.php'; | |
| exit; | |
| } | |
| } | |
| add_action( 'template_redirect', 'rssa_content_mobile_view' ); |
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
| // Put this function in your theme's functions.php (or even better, in an ajax.php file in the | |
| // theme that is require'd in): | |
| /* The function ajax_read_more() will be called when the following URL is requested | |
| * from WordPress: | |
| * | |
| * http://www.yoursite.com/wp-admin/admin-ajax.php?action=read_more&limit=5 | |
| */ | |
| function ajax_read_more() { | |
| // Take in a few input parameters from $_GET or $_POST (depending on how you're passing the values) about |
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
| // Make the permalink structure for the Video post type match that of regular /YYYY/MM/DD/slug/ posts. | |
| function bc_post_type_link( $url, $post ) { | |
| if ( 'bc-video' == get_post_type( $post ) ) { | |
| $url = home_url() . '/%year%/%monthnum%/%day%/%postname%/'; | |
| $post_date = strtotime( $post->post_date ); | |
| $url = str_replace( | |
| array( | |
| '%year%', |
SQL String Escaping
Here's an example of using grep to find all instances of the word "insert" (ignoring case):
ssyed@server:~$ cd /var/www/
ssyed@server:/var/www$ grep -Ri insert .
... a whole bunch of results ...
./folder_button/jsinclude_server_com_ccare.php:$query = "INSERT INTO log VALUES(NULL, '$ip', '$hostname', '". $_SERVER['HTTP_REFERER'] ."', '". $data['queue_id'] ."', '". $data['status_id'] ."','". $_SERVER['HTTP_USER_AGENT'] ."');";
... a whole bunch more results ...
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 term ID for the video category. | |
| $video_category_term = get_term_by('slug', 'video-landing-page', 'video-categories'); | |
| $video_category_term_id = $video_category_term->term_id; | |
| // Find the bc-video-strip post associated to that video category. | |
| $strip_query = new WP_Query( | |
| array( | |
| 'post_type' => 'bc-video-strip', | |
| 'tax_query' => array( | |
| array( |