Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
| (function () { | |
| MyApp.AlertView = Backbone.View.extend({ | |
| tagName: "div", | |
| className: "alert fade", | |
| template: ["<a href=\"#\" data-dismiss=\"alert\" class=\"close\">×</a>", "<strong>{{ title }}</strong>", "{{ message }}"].join("\n"), | 
| <?php | |
| //returns a big old hunk of JSON from a non-private IG account page. | |
| function scrape_insta($username) { | |
| $insta_source = file_get_contents('http://instagram.com/'.$username); | |
| $shards = explode('window._sharedData = ', $insta_source); | |
| $insta_json = explode(';</script>', $shards[1]); | |
| $insta_array = json_decode($insta_json[0], TRUE); | |
| return $insta_array; | |
| } | 
| <?php | |
| // get next and prev products | |
| // Author: Georgy Bunin ([email protected]) | |
| // forked from https://gist.github.com/2176823 | |
| function ShowLinkToProduct($post_id, $categories_as_array, $label) { | |
| // get post according post id | |
| $query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array( | |
| array( | |
| 'taxonomy' => 'product_cat', | 
| <?php | |
| // Resizer and Image Manipulation | |
| // Based on: http://forums.laravel.com/viewtopic.php?id=2648 | |
| public function post_edit_logo($id) | |
| { | |
| $rules = array( | |
| 'image' => 'image', | |
| ); | 
| // node: | |
| var moment = require('moment'); | |
| moment().add('days', 2).fromNow(); | |
| // 'in 2 days' | |
| moment().subtract('days', 2).fromNow(); | |
| // '2 days ago' | |
| moment('November 1977').fromNow() | 
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.