Here's the base sanitizer:
<?php
namespace FooProject\Internal\Sanitizers;
abstract class BaseSanitizer
{
/**| /* | |
| See dev dependencies https://gist.github.com/isimmons/8927890 | |
| Compiles sass to compressed css with autoprefixing | |
| Compiles coffee to javascript | |
| Livereloads on changes to coffee, sass, and blade templates | |
| Runs PHPUnit tests | |
| Watches sass, coffee, blade, and phpunit | |
| Default tasks sass, coffee, phpunit, watch | |
| */ |
| (function() { | |
| function DateDiff(date1, date2) { | |
| this.days = null; | |
| this.hours = null; | |
| this.minutes = null; | |
| this.seconds = null; | |
| this.date1 = date1; | |
| this.date2 = date2; |
| function convertMS(ms) { | |
| var d, h, m, s; | |
| s = Math.floor(ms / 1000); | |
| m = Math.floor(s / 60); | |
| s = s % 60; | |
| h = Math.floor(m / 60); | |
| m = m % 60; | |
| d = Math.floor(h / 24); | |
| h = h % 24; | |
| return { d: d, h: h, m: m, s: s }; |
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
Here's the base sanitizer:
<?php
namespace FooProject\Internal\Sanitizers;
abstract class BaseSanitizer
{
/**| function meThinks(assertion) { | |
| return { | |
| shouldEqual: function(bool) { | |
| if ( assertion !== bool ) { | |
| throw new Error('FAIL'); | |
| } | |
| } | |
| }; | |
| } |
| $.getJSON('http://173.255.193.46/api/edge/popular:themeforest.json?callback=?', function(files) { | |
| var imgs; | |
| files = files.popular; | |
| console.log(files); // see what's available to play with | |
| imgs = $.map(files.items_last_week, function(file, i) { | |
| return '<a href="' + file.url + '"><img src=' + file.thumbnail + '></a>'; | |
| }); |
| // Very simple. Just handles the process of | |
| // display an unordered list of movies, | |
| // while providing the ability to edit each movie | |
| // and update the model. | |
| // Any glaring bad practices? Still in the early | |
| // Backbone learning stages. | |
| (function(Movie) { |
| <?php | |
| $template = "I am {{name}}, and I work for {{company}}. I am {{age}}."; | |
| # Your template tags + replacements | |
| $replacements = array( | |
| 'name' => 'Jeffrey', | |
| 'company' => 'Envato', | |
| 'age' => 27 | |
| ); |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');