Author Archives: TroyThib

PHP – read text file and get contents

<?php $myfile = fopen(“file-to-read.txt”, “r”) or die(“Unable to open file!”); // Output one line until end-of-file while(!feof($myfile)) { echo fgets($myfile) . “<br>”; } fclose($myfile); ?>

Posted in PHP/MySQL | Tagged , | Comments Off on PHP – read text file and get contents

PHP – Connect to database

Connect to database $host_name = “dbhost.com”; $database = “dbname”; $user_name = “dbusername”; $password = “dbpassword”; $connect = mysqli_connect($host_name, $user_name, $password, $database); if (mysqli_connect_errno()) { echo “Failed to connect to MySQL: ” . mysqli_connect_error(); } else echo ‘You are connected to … Continue reading

Posted in PHP/MySQL | Comments Off on PHP – Connect to database

Create a JavaScript array and loop through it

Create a JavaScript array and loop through it: var theBeatles = [ “John Lennon”, “Paul McCartney”, “George Harrison”, “Ringo Starr” ]; for (i = 0; i < theBeatles.length; i++) { $(‘#myDiv’).append(theBeatles[i]+’ ‘); }

Posted in JavsScript, jQuery | Tagged , , , , | Comments Off on Create a JavaScript array and loop through it

Scroll to ID – JavaScript and jQuery

When you have internal page links (anchor links) and you want a nice scroll effect instead the harshness of just the immediate jump-to that internal links give you, use some fun jQuery to get er done. // scroll to ID … Continue reading

Posted in JavsScript, jQuery | Tagged , , , | Comments Off on Scroll to ID – JavaScript and jQuery

Web fonts not showing up on your WordPress site?

Don’t you hate it when you spend 30 minutes on an issue, and when you finally find the answer, you go… oh yea, now I remember? I had some custom fonts on my site that I was loading using @font-face. … Continue reading

Posted in htaccess, Web Fonts | Tagged , , , , | Comments Off on Web fonts not showing up on your WordPress site?

Websites With Beautiful Video Headers

http://webdesignledger.com/websites-with-beautiful-video-headers

Posted in Design, Web Dev | Comments Off on Websites With Beautiful Video Headers

Get you LAN IP

Go to the command prompt (cmd) and type in “ipconfig”.  IPv4 Address. . . . . . . . . . . : 172.25.202.46

Posted in Server (IIS, Appache, etc.) | Comments Off on Get you LAN IP

5 nifty JavaScript tricks that you may not know

I like the first one the most from this post, so I am posting it here, but the others are cool too.  1. A compact string comparision Let’s say you want to check if a string value is present in … Continue reading

Posted in JavsScript | Comments Off on 5 nifty JavaScript tricks that you may not know

How to Create a Basic jQuery Plugin

This is one of the best “to the point” jQuery plugin tutorials I have seen. http://learn.jquery.com/plugins/basic-plugin-creation/

Posted in JavsScript, jQuery | Comments Off on How to Create a Basic jQuery Plugin

8 simple CSS hover effects

Very cool and easy modern CSS effects: http://www.developerdrive.com/2015/01/8-simple-css-hover-effects/

Posted in CSS3, HTML/CSS | Comments Off on 8 simple CSS hover effects

More form input cleaning – Validating Sanitizing and Escaping User Data

This article is somewhat specific to WordPress, but the principals are universal. https://codex.wordpress.org/Validating_Sanitizing_and_Escaping_User_Data

Posted in PHP/MySQL, WordPress | Comments Off on More form input cleaning – Validating Sanitizing and Escaping User Data

Handling Long Words and URLs (Forcing Breaks, Hyphenation, Ellipsis, etc)

All from css-tricks: There are times when a really long string of text can overflow the container of a layout. For example: URL’s don’t typically have spaces in them, so they are often culprits.Here’s a big snippet with all the … Continue reading

Posted in HTML/CSS, Web Dev | Comments Off on Handling Long Words and URLs (Forcing Breaks, Hyphenation, Ellipsis, etc)

Serious Form Security with PHP from CSS-Tricks

I great PHP article on for security. Besides stripping tags and CAPTCHA type checks, it also using a token matching system and creating a white list, and hack log.  https://css-tricks.com/serious-form-security/

Posted in PHP/MySQL | Tagged , , , | Comments Off on Serious Form Security with PHP from CSS-Tricks

HTML dev – Android Gmail App sucks

Not exactly sure what this does, but it could help with some spacing issues. <table style=”display: block”> <tr style=”display: block; white-space: nowrap;”><td style=”display: inline-block;”> <img> </td><td style=”display: inline-block;”> <img> </td></tr> </table>

Posted in Email Dev | Comments Off on HTML dev – Android Gmail App sucks

6 Practical Examples For Building Parallax Websites

http://tutorialzine.com/2015/09/6-practical-examples-for-building-parallax-websites/

Posted in JavsScript, jQuery, Parallax | Comments Off on 6 Practical Examples For Building Parallax Websites

Angular tutorials

www.fromdev.com/2015/06/angular-js-tutorials-pdf.html

Posted in Angular | Comments Off on Angular tutorials

15 Advanced Security Tips To Make Your WordPress Site Bulletproof

Very important WordPress security tips. https://www.corephp.com/blog/15-advanced-security-tips-to-make-your-wordpress-site-bulletproof/

Posted in WordPress | Tagged , | Comments Off on 15 Advanced Security Tips To Make Your WordPress Site Bulletproof

ExactTarget AMPscript Base64 Encode

VAR @email, @encodedEmail, @DecodedEmail SET @email = emailaddr SET @encodedEmail = Base64Encode(@email) SET @DecodedEmail = Base64Decode(@encodedEmail) Email: %%= v(@email) =%% Encoded Email: %%= v(@encodedEmail) =%% Decoded Email: %%= v(@DecodedEmail) =%%

Posted in AmpScript, Email Dev, ExactTarget | Tagged , , , , | Comments Off on ExactTarget AMPscript Base64 Encode

I have not personally been able to make this work, but I’ve only tried on one client email, so I’m keeping this code handy for the future. The text below is taken directly from freshinbox.com. I’m not trying to pretend it’s … Continue reading

Posted in Email Dev | Tagged , , , , | Comments Off on

7 Essential JavaScript Functions

More mad knowledge from David Walsh. http://davidwalsh.name/essential-javascript-functions

Posted in JavsScript | Tagged , , , , , , , | Comments Off on 7 Essential JavaScript Functions

Link not working when behind a stacked DIV?

You have a div stacked on another div, and the div below has links that aren’t clickable because of the div on top. Even if the div on top has a transparent background. Try this: pointer-events: none;Important note: if the … Continue reading

Posted in HTML/CSS, Web Dev | Tagged , , , , | Comments Off on Link not working when behind a stacked DIV?

http://davidwalsh.name/regular-expressions-rest

Great article for the RegExp challenged out there. Of course it’s by David Walsh. http://davidwalsh.name/regular-expressions-rest

Posted in Regular Expressions | Comments Off on http://davidwalsh.name/regular-expressions-rest

CSS3 Animations – @keyframes

This post rounds up 10 articles that explain how to use this cool CSS3 feature, each with examples and demos. http://line25.com/articles/useful-links-for-learning-css-keyframes-animation

Posted in CSS3, HTML/CSS | Comments Off on CSS3 Animations – @keyframes

Email subject lines – special characters

For people who are on PCs using Outlook, that icon with the two beer glasses does not render, but many other icons do. I don’t have a complete list of which ones do and which ones don’t, but I’ve tried … Continue reading

Posted in Email Dev | Comments Off on Email subject lines – special characters

ExactTarget AMPscript – Content Syndication – external content and stuff

What ExactTarget calls “Content syndication” is merely external content pulled into the email. It’s like includes PHP or a “Content Scrape” in Silverpop. It’s pretty simple, except when it comes to dynamic content in the link itself, or in the … Continue reading

Posted in AmpScript, Email Dev, ExactTarget, Uncategorized | Comments Off on ExactTarget AMPscript – Content Syndication – external content and stuff

Embed PHP Code in CSS files

Embed PHP Code in CSS files. March 26, 2011, Rahul, Uncategorized, , 7 Comments Have you been embedding CSS Styles into PHP files just for the sake of making the styles dynamic?Ever wished to add PHP codes in CSS files … Continue reading

Posted in PHP/MySQL | Comments Off on Embed PHP Code in CSS files

Find WordPress database info

In the root folder of the site, look for a file called wp-config.php.

Posted in WordPress | Tagged , , , , , , | Comments Off on Find WordPress database info

line break in code adds white space between elements.

line break in code adds white space between elements, specifically inline-block elements.  One fix is to add display:flex to the parent element. This doesn’t seem to work for Safari. Another fix is to add font-size: 0 to the parent element. … Continue reading

Posted in HTML/CSS, HTML5 | Comments Off on line break in code adds white space between elements.

Use preventDefault() to stop a link from trying to open URL

This comes into play when using anchor links to trigger JS functions. For example, you might have a link that jumps you to a section of the same page, but the click even also triggers some other functions, like animating … Continue reading

Posted in JavsScript, jQuery | Tagged , , , | Comments Off on Use preventDefault() to stop a link from trying to open URL

Visited link color in HTML emails

I did I very small amount of testing, but I was specifically trying to changed the default visited link color in Outlook 2007. The default color is the awefull purple that used to be all over the place on web … Continue reading

Posted in Email Dev | Tagged , , , | Comments Off on Visited link color in HTML emails

Create a child theme

This info came mostly from  http://www.elegantthemes.com/blog/resources/wordpress-child-theme-tutorial and some of my own experiences. Create a new folder for your child theme. /parenttheme-child/ is the convention. Within your new theme folder, create a file called style.css and fill in the information as … Continue reading

Posted in WordPress | Comments Off on Create a child theme

Swap columns – change order of DIVs

Here’s the scenario. You have a two column layout. Maybe you have some copy on the left and a hero image on the right. This works great for desktops, and for mobile you want to stack the columns, but it reads … Continue reading

Posted in jQuery | Tagged , , , | Comments Off on Swap columns – change order of DIVs

55 Jquery Tutorials, Resources, Tips And Tricks: Ultimate Collection

Good stuff: http://www.1stwebdesigner.com/53-jquery-tutorials-resources-tips-and-tricks-ultimate-collection/

Posted in jQuery | Comments Off on 55 Jquery Tutorials, Resources, Tips And Tricks: Ultimate Collection

40 Resources Every Designer Should Know

Awesome collection of design resources. 40 Resources Every Designer Should Know http://www.otherfocus.com/40-resources-every-designer-should-know/ 

Posted in Design, Web Dev | Comments Off on 40 Resources Every Designer Should Know

Jquery – click hover animate

$(“.hover”).hover(function(){ $(this).animate({ fontSize:’20px’, opacity:’0.5′ }); },function(){ $(this).animate({ fontSize:’16px’, opacity:’1′ });}); $(“.click”).click(function(){ $(‘.click’).animate({ fontSize:’20px’, opacity:’0.5′ });}););

Posted in jQuery | Tagged , , , | Comments Off on Jquery – click hover animate

Replace WordPress logo on login page

You can either replace the image, or edit the CSS. wp-admin / css / login.min.css There might be an easier way than this. I spend 5 min doing this, and no research, so there might be a built in function … Continue reading

Posted in WordPress | Comments Off on Replace WordPress logo on login page

Silverpop adds nbsp after copy in text ruleset

I have a client who has two brands that have a different style guide for each, and one says “e-mail” and the other says “email”. So, I set up a ruleset to check a field that tells me which brand, … Continue reading

Posted in Email Dev | Tagged , | Comments Off on Silverpop adds nbsp after copy in text ruleset

Logo inspiration

LogoPond.com http://logopond.com/ LogoFaves.comhttp://logofaves.com/ www.awwwards.com/99-creative-logo-designs-for-inspiration.htmlhttp://www.awwwards.com/99-creative-logo-designs-for-inspiration.html

Posted in Logo Inspiration | Comments Off on Logo inspiration

Line height (line-height) issue in Outlook 2010

Line height (line-height) issue in Outlook 2010 Add mso-line-height-rule:exactly just before your line-height declaration. < td style=“mso-line-height-rule:exactly; line-height:50px;> This fix ONLY works on block elements. So trying to achieve the same effect inside a font or span tag will not … Continue reading

Posted in Email Dev | Tagged , , | Comments Off on Line height (line-height) issue in Outlook 2010

Email: Weird border showing up around TD on mobile devices

Weird border showing up around TD on mobile devices. It was either a border or a 1px space showing up around table cells. It was only mobile devices. I was seeing it on iPads and my Android phone.   The … Continue reading

Posted in Email Dev | Tagged , , , , | Comments Off on Email: Weird border showing up around TD on mobile devices

CSS Even and Odd Rules

STATUS Warning: at the time of writing (February 2003), the major browsers don’t yet support the ‘nth-child’ selector (introduced in November 2001) and only very few support the COL element. EVEN AND ODD RULES One way to improve the readability … Continue reading

Posted in HTML/CSS | Tagged , , | Comments Off on CSS Even and Odd Rules

Making Custom CSS3 Video Players With HTML5 and Javascript

http://www.inserthtml.com/2013/03/custom-html5-video-player

Posted in HTML5 Video | Comments Off on Making Custom CSS3 Video Players With HTML5 and Javascript

The Command Line Crash Course

Super fast course in using the command line. http://cli.learncodethehardway.org/book/

Posted in Command Line | Tagged , , | Comments Off on The Command Line Crash Course

ExactTarget AMPscript: Issue with links not working when URL is pulled from data

Here’s the scenario. We had links where the URL was populated from the data. The field was called “URL”, and it contained URLs without the http://. So, my code looked like this: <a href=”http://%%URL%%”>%%URL%%</a> Pretty straight forward. Well, the data … Continue reading

Posted in AmpScript, Email Dev, ExactTarget | Comments Off on ExactTarget AMPscript: Issue with links not working when URL is pulled from data

HTML5 Techniques for Optimizing Mobile Performance

This article discusses the bare minimum of what it takes to create a mobile HTML5 web app. http://www.html5rocks.com/en/mobile/optimization-and-performance/

Posted in CSS3, JavsScript, Mobile | Comments Off on HTML5 Techniques for Optimizing Mobile Performance

CSS background cover and contain

This will fill the background with the image. Some parts of the image may be hidden -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;background-repeat: no-repeat;background-position: top center;background-attachment: fixed;background-image: url(../images/fish.jpg); This will show all of the background image. Unless the images is the same dimensions … Continue reading

Posted in CSS3, HTML/CSS | Tagged , | Comments Off on CSS background cover and contain

Sidebar Transitions – cool CSS nav transitions

http://tympanus.net/Development/SidebarTransitions/

Posted in CSS3, HTML/CSS, HTML5 | Comments Off on Sidebar Transitions – cool CSS nav transitions

Another great Litmus article: Using HTML5 and CSS3 in Email

Using HTML5 and CSS3 in Email https://litmus.com/blog/a-bulletproof-guide-to-using-html5-and-css3-in-email?utm_campaign=bestpractices_HTML5CSS3?utm_source=twitter&utm_medium=social

Posted in Email Dev | Comments Off on Another great Litmus article: Using HTML5 and CSS3 in Email