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 / 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 / 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 / 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 / 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 / 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 / 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 / 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');