Archive for the “Web Shots” Category

CSS3 Animation with transform: scale(n, n);

Posted on June 25th, 2014 by webninjataylor

<div class=”animateable”></div> /******** SCALE ********/ .animateable { … animation: inout 2s; -webkit-animation: inout 2s; animation-iteration-count: 1; -webkit-animation-iteration-count: 1; } @keyframes inout { 0% { transform: scale(0, 0); } 50% { transform: scale(2, 2); } 100% { transform: scale(1, 1); } } @-webkit-keyframes inout { /* Safari & Chrome */ 0% { -webkit-transform: scale(0, 0); } […]

Tags:
Posted in Web ShotsComments Off on CSS3 Animation with transform: scale(n, n);

Video as Page Background

Posted on June 25th, 2014 by webninjataylor

<div id=”bigvid”> <video id=”big-video-vid_html5_api” class=”vjs-tech” preload=”auto” data-setup=”{}” webkit-playsinline=”” autoplay=”autoplay” src=”http://barrelny.com/recap/2012/wp-content/themes/barrel-portfolio/im/office_small.mp4″ loop></video> </div> #bigvid { position: absolute; background-color: #000; height: 100%; width: 100%; }

Tags: ,
Posted in Web ShotsComments Off on Video as Page Background

CSS3 Text and Motion Experiment

Posted on June 25th, 2014 by webninjataylor

Animating with CSS can be as simple as using transform and/or transition on elements and setting the final animation state via a pseudo-class like :hover… … #text { … top:200px; … opacity: 0; -webkit-transition: all 2s linear; -moz-transition: all 2s linear; } #photo { opacity: 0.25; -webkit-transform: scale(1.5) translate3D(0, 0, 0); -webkit-transition: all 5s linear; […]

Tags:
Posted in Web ShotsComments Off on CSS3 Text and Motion Experiment

Embed a Fiddle

Posted on June 25th, 2014 by webninjataylor

<iframe src=”http://jsfiddle.net/USERNAME/FIDDLE/embedded/result,resources,html,css,js” width=”100%” height=”300″ frameborder=”0″ allowfullscreen=”allowfullscreen”></iframe>

PHP Switch

Posted on June 24th, 2014 by webninjataylor

Switch is an abbreviated version of if, else if, etc… <?php switch($_POST[‘color’]) { case ‘white’: case ‘black’: $clean[‘color’] = $_POST[‘color’]; break; } ?>

Tags:
Posted in Web ShotsComments Off on PHP Switch

PHP Sanitize Input

Posted on June 24th, 2014 by webninjataylor

<?php //Initialize an empty array for storing filtered, escaped input $clean = array(); //Wash Basic Input Fields function washnormal(){ //Use the global $clean array global $clean; //Loop through the fields passed to the function for ($i = 0; $i < func_num_args(); $i++){ $item = func_get_arg($i); //Regular expression matching for lowercase letters, uppercase letters, digits, periods, […]

Tags:
Posted in Web ShotsComments Off on PHP Sanitize Input

PHP Includes

Posted on June 24th, 2014 by webninjataylor

You should store include files outside of the document root for security.

Tags:
Posted in Web ShotsComments Off on PHP Includes

Clearing Variables and Record Sets in PHP

Posted on June 24th, 2014 by webninjataylor

Clear a variable’s value(s) <?php unset($variable); ?> Clear a long record set to free memory. Only needs to be called if you are concerned about how much memory is being used for queries that return large result sets. All associated result memory is automatically freed at the end of the script’s execution. <?php mysql_free_result($rsXYZ); ?>

Tags:
Posted in Web ShotsComments Off on Clearing Variables and Record Sets in PHP

PHP Arrays

Posted on June 24th, 2014 by webninjataylor

<?php //Associative multidimensional array with named keys, called in reverse order to avoid returning NULL $menuTests = array( ‘ALMA’ => ‘/index.php/about/facilities/alma’, ‘EVLA’ => ‘/index.php/about/facilities/vlaevla’, ‘SKA’ => ‘/index.php/about/facilities/ska’, ); $menu = array( ‘Home’ => ‘/index.php’, ‘Tests’ => array(‘/cosmicradio/test.php’,$menuTests), ‘Cosmic Radio’ => ‘/cosmicradio/index.php’ ); echo “<pre>”; var_dump($menu); echo “</pre>”; echo $menu[‘Tests’][1]; foreach($menu as $itemPrimary => $urlPrimary){ echo […]

Tags:
Posted in Web ShotsComments Off on PHP Arrays

Basic Restricted Pages with PHP

Posted on June 24th, 2014 by webninjataylor

Create database with tables (at least 2 with 1 being for users) Create a user with limited privledges to the database Create a connection file using the new user Use the following on the main public page to ensure no sessions are currently active //CALL SESSION AND DESTROY session_start(); unset($_SESSION); session_destroy(); Create a loginfailed page […]

Tags:
Posted in Web ShotsComments Off on Basic Restricted Pages with PHP

Recommended Dev Tools

Posted on June 24th, 2014 by webninjataylor

Sublime Text 2  Xcode Install and launch XCode from the App Store Press ⌘ + , to open the preferences pane Click the Downloads tab and then the install button next to “Command Line Tools” Git (https://help.github.com/articles/set-up-git) PIP sudo easy_install pip Node Fabric sudo pip install fabric Dropbox ImageOptim Jing MAMP Spectacle Photoshop VirtualBox PhoneGap

Tags:
Posted in Web ShotsComments Off on Recommended Dev Tools

jQuery: Working with JSON via AJAX

Posted on June 24th, 2014 by webninjataylor

JSON property keys are always in quotes, but not in JS XHR = XML HTTP Request CFM = Control Flow Management (ex. page loading and data loading asynchronously) $.ajax({    url: ”,    data: {‘myUrlParams’: ‘value’},    success: function(){…},    error: function(){…},    dataType: ‘json’ // use jsonp for cross-domain });

Creating a jQuery Plugin

Posted on June 24th, 2014 by webninjataylor

$.fn.makeTabsFor = function(){…};   // Create method $(tabs).makeTabsFor(content);   // Call method $.fn.makeTabsFor(content); // Call method when no selector is used When your plugin code gets called, it’s called in the context of the selected jQuery object, so the method “this” becomes the jQuery object itself.

jQuery Animations

Posted on June 24th, 2014 by webninjataylor

Animations initiated by the user should be quick while animations initiated by the website can be slower to draw attention Animations create ‘eye-light’ and affordance for a website Use the jQuery easings plugin (or jQuery UI) since jQuery only comes with swing and linear A common configuration of the method’s arguments is… The hash (aka object or properties […]

Joomla Basics

Posted on June 24th, 2014 by webninjataylor

Customizations Tiny MCE Plugin extended valid elements ul[id|class|style], li[id|class|style], script[type|src], img[id|name|src|alt|width|height|border|align|style|class], form[name|id|method|action|onsubmit], input[name|id|type|value|style], textarea[name|id|cols|rows|class|style], a[href|id|class|style|onmouseover|onmouseout], embed[width|height|name|src|type|class|style], iframe[id|src|width|height|style|scrolling], span[id|class|style], div[name|id|class|style] Remove Table layout for true CSS contentpaneopen TABLE = components\com_content\views\article\tmpl\default.php(54) Joomla Issues Search Engine Friendly URLs in Joomla cause image on section pages not to show, but need for home images and login page …so section […]

JavaScript: Things to Know in 2014

Posted on June 24th, 2014 by webninjataylor

Here’s a list I’ve compiled from interviews and articles of core JavaScript knowledge for 2014… Event delegation and bubbling Prototypes and inheritance Functions are first-class objects Modular JavaScript Constructor-based approach vs. mixins How to control “this” through bind, apply, and call Async code and how to manage it through things like promises and queues Code testing […]

The Proper Way to Add CSS and JS to a WordPress Theme

Posted on June 23rd, 2014 by webninjataylor

Add this to functions.php for JS and CSS.  Check out the WordPress Codex for available parameters and info on using the ‘$’ namespace for jQuery. <?php function wnt_styles(){ // STYLES wp_register_style(‘bootstrapcss’, get_template_directory_uri() . ‘/css/bootstrap.css’, array(), ‘20140529’, ‘all’ ); wp_enqueue_style(‘bootstrapcss’); } add_action(‘wp_enqueue_scripts’, ‘wnt_styles’); wp_enqueue_script(‘jquery’); // This is all that’s needed for jQuery since WordPress already has […]

WordPress Child Themes

Posted on June 23rd, 2014 by webninjataylor

Use child themes to avoid losing changes when themes are updated by their vendors. Create a new theme folder with the same name as its parent, plus “-child” appended to it Create a style.css file with at least the following three required lines… Theme Name (ex.Theme Name: Twenty Fourteen Child) … NOTE: No spaces allowed […]

SharePoint 2013 Developer Tips

Posted on June 23rd, 2014 by webninjataylor

Tips You can add scripts to page layouts after a snippet’s <div></div>, but not within the snippet in the layout file Bootstrap JS files conflict with SP core; edits won’t save in browser HTML for SharePoint Ingestion No <form> tags No <style> tags Use ms-design-css-conversion=”no” in the CSS <link> tag if using web fonts SP […]