Skip to content

Instantly share code, notes, and snippets.

View katienelson's full-sized avatar

Katie Nelson katienelson

View GitHub Profile
@katienelson
katienelson / stringLimiter.php
Created July 24, 2014 16:24
String Limiter - Limit a string to a maximum length of $limit and append '...' before returning value. Originally written as a ModX snippet
<?php
/**
* Limit a string to a maximum length of $limit and append ... before returning
* Default Limit: 30
*/
if(!isset($string)){ return; }
if(!isset($limit)){ $limit = 30; }
if(strlen($string) > $limit){ // if the string is too long
@katienelson
katienelson / slide-up-fade-in.html
Last active September 24, 2019 18:05
Slide Up Fade In - Keyframe animation and CSS class. Apply .slide-up-fade-in to element you wish to apply the effect. Demo on http://codepen.io/katienelson/pen/KwXEzN
<div class="outer-square">
<div class="square slide-up-fade-in">
<h3 class="slide-up-fade-in">Title</h3>
<p class="slide-up-fade-in">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
<p class="slide-up-fade-in">Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>
<div class="clearfix"></div>
</div>
@katienelson
katienelson / Direction-aware-3D-hover-effect-(Concept).markdown
Created February 5, 2015 10:28
Direction-aware 3D hover effect (Concept)

Direction-aware 3D hover effect (Concept)

After seeing this site http://fitzfitzpatrick.com/ I decided to give a try to the "direction-aware hover effect". My first thought was to do it with a pure CSS, not too late I changed my mind and decided to use JS (I need to sleep anyway).

It's kind of simple, using JS we can easily detect the direction the cursor is coming, then, I am using CSS animations for each case (8 in total).

A Pen by Noel Delgado on CodePen.

License.

@katienelson
katienelson / wp-login-activity-functions.php
Last active December 2, 2015 16:22
Wordpress funtions to set and get a users last login activity (put in functions.php)
//associating a function to login hook
add_action('wp_login', 'set_last_login');
//function for setting the last login
function set_last_login($login) {
$user = get_userdata($login);
//add or update the last login value for logged in user
update_user_meta( $user->ID, 'last_login', current_time('mysql') );
}
$(document).ready(function(){
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
var $target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {