Skip to content

Instantly share code, notes, and snippets.

@Boztown
Boztown / 1.php
Created January 2, 2014 22:46
Popular posts (by comment count) in Wordpress with no plug-in
<?php $pop = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}posts WHERE post_type='post' AND post_status='publish' ORDER BY comment_count DESC LIMIT 10"); ?>
<?php foreach($pop as $post) : ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endforeach; ?>
@Boztown
Boztown / 1.yml
Last active January 2, 2016 00:38
# SQLite version 3.x
# gem install sqlite3
#
# Ensure the SQLite 3 gem is defined in your Gemfile
# gem 'sqlite3'
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
<p>This page took <?php timer_stop(1); ?> seconds to generate.</p>
$ lessc -x styles.less styles.css
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Finn','','[email protected]','Malaysia,'19');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Kaseem','','Curabitur.vel.lectus@malesuadaIn egerid.edu','Seychelles','70');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Nolan','','[email protected],'Costa Rica','27');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Marcia','','[email protected],'Portugal','57');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Aurelia','','[email protected],'Hong Kong','83');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Avram','','[email protected]','Gibraltar,'98');
INSERT INTO `users` (`firstname`,`lastname`,`email`,`country`,`avatar_id`) VALUES ('Alexander','','[email protected]','Iceland,'55);
@Boztown
Boztown / 1.cs
Created December 20, 2013 20:31
C# Split string (Argument type 'string' is not assignable to 'char')
string[] info = commandArgument.Split("|");
@Boztown
Boztown / 1.cs
Created December 20, 2013 20:29
C# Get YouTube ID from URL.
(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&amp;]v=)|youtu\.be\/)([^""&amp;?\/ ]{11})
<asp:RadioButtonList ID="FormTypeSelection" RepeatLayout="UnorderedList" runat="server">
<asp:ListItem Value="0">Canada</asp:ListItem>
<asp:ListItem Value="1">Denmark</asp:ListItem>
<asp:ListItem Value="2">Tobahaw</asp:ListItem>
</asp:RadioButtonList>
@Boztown
Boztown / 1.php
Last active December 31, 2015 23:29
Grab and RSS Feed with PHP.
<?php getFeed("http://ryanbosinger.com/blog/feed", 3); ?>
if (model.ThumbnailFile != null)
{
var thumbGUID = Guid.NewGuid();
var newFilename = thumbGUID + ".jpg";
// save thumbnail
model.ThumbnailFile.SaveAs(imageUploadPath + "/" + newFilename);