Skip to content

Instantly share code, notes, and snippets.

View dlucero23's full-sized avatar
💭
Hacking together a Reddit bot

Diego Lucero dlucero23

💭
Hacking together a Reddit bot
View GitHub Profile
@dlucero23
dlucero23 / wpsearchreplace.txt
Last active April 11, 2016 14:23
WordPress MySQL Search and Replace script. run this from the command line
UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');
@dlucero23
dlucero23 / countdownexample.html
Created April 11, 2016 14:26
JS 5 minute countdown script. Great for adding to a landing pages where you would like the contact to take a specific action within a short amount of time.
<body>
<div>Registration closes in <span id="time">05:00</span> minutes!</div>
</body>
@dlucero23
dlucero23 / simplecssdropcap.html
Created April 11, 2016 14:38
Simple CSS Dropcap for articles and blogposts. Options to have the dropcap automatically set the first character in the article to dropcap, and any other character that has the class: 'dropcap' will be rendered as a dropcap as well. See it live here: http://codepen.io/anon/pen/oIwsr
<body>
<p>
<span class="foo">T</span>his page is built for you. It’s where you and I can leave links and documents to communicate regarding your Budget Tool App. For now, most links will not work, since the majority of the site is still being developed. So I received the application from the Indian Company, and I am less than happy with the end result. You can see what they produced at this link here. This page is built for you. It’s where you and I can leave links and documents to communicate regarding your Budget Tool App. For now, most links will not work, since the majority of the site is still being developed. So I received the application from the Indian Company, and I am less than happy with the end result. You can see what they produced at this link here.
</p>
<p>
<span class="bar dropcap">T</span>his page is built for you. It’s where you and I can leave links and documents to communicate regarding your Budget Tool App. For now, most links will not work, since the majority of the s
@dlucero23
dlucero23 / simplecssloadingbar.css
Created April 11, 2016 14:42
Simple, Animated CSS Loading Bar
#outer-barG{
height:37px;
width:299px;
border:2px solid steelblue;
overflow:hidden;
background-color:khaki;
margin 0 auto 0 auto;
}
.bar-lineG{
@dlucero23
dlucero23 / deletenonapprovedcomments.txt
Created April 11, 2016 14:46
SQL Script: Delete all non approved comments in WP
DELETE from wp_comments WHERE comment_approved = '0';
@dlucero23
dlucero23 / equalheightcolumnscript.js
Last active April 11, 2016 15:03
JS script: create equal height columns. Needs class or id set
var getMaxHeight = function ($elms) {
var maxHeight = 0;
$elms.each(function () {
var height = $(this).height();
if (height > maxHeight) {
maxHeight = height;
}
});
return maxHeight;
};
@dlucero23
dlucero23 / highlighttextscript.js
Last active April 11, 2016 15:03
JS Script: Simple Highlight text tool. See it live here: http://jsbin.com/iledos/6/edit?html,css,js,output
function highlight(text, words, tag) {
// Default tag if no tag is provided
tag = tag || 'span';
var i, len = words.length, re;
for (i = 0; i < len; i++) {
// Global regex to highlights all matches
re = new RegExp(words[i], 'g');
if (re.test(text)) {
@dlucero23
dlucero23 / autocopyrightyear.html
Last active August 18, 2017 22:56
Auto Updating Copyright Year JS Script. Great for including in footers
<p>©2012<span id="autodate"></span> Siam Tek is a Trademark of Siam Tek Web Design Group, LLC, <br>POWERED BY <a href="//siamtek.com/solutions" title="Siam Tek Web Design Group - Digital Marketing for Online Businesses">Siam Tek - Tampa Bay Digital Marketing.</a></p>
@dlucero23
dlucero23 / redirectcf7.js
Last active April 20, 2016 15:11
Redirect to URL after successful submission of a Contact Form 7 Form. To be added to the "Additional Settings (2)" section.
// after form is submitted, redirect to this domain.
on_sent_ok: "location = 'https://yourdomain.com/your-thank-you-page/';"
@dlucero23
dlucero23 / LandingPages-custom-post-type-addto-functions.php
Last active September 29, 2019 01:51
This useful little snippet can be added to a child theme to add a new custom post type called 'Landing Pages' which help to separate any landing pages from regular website page post_types.
// == LANDING PAGES
if ( ! function_exists('custom_post_type') ) {
// Register Custom Post Type
function custom_post_type() {
$labels = array(
'name' => _x( 'Landing Pages', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Landing Page', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Landing Pages', 'text_domain' ),