This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # Instead of | |
| $name = 'Jeff'; | |
| switch ($name) { | |
| case 'Jeff': | |
| echo "I'm Jeff"; | |
| break; | |
| case 'Joe': |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(window).scroll(function() { | |
| var scroll = $(window).scrollTop(); | |
| if (scroll > 50) { | |
| $(".menu-bar").addClass("menu-bar-scroll"); | |
| } else { | |
| $(".menu-bar").removeClass("menu-bar-scroll"); | |
| } | |
| }); | |
| (function(){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| <a href="posts/2" data-method="delete"> <---- We want to send an HTTP DELETE request | |
| - Or, request confirmation in the process - | |
| <a href="posts/2" data-method="delete" data-confirm="Are you sure?"> | |
| */ | |
| (function() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).ready(function() { | |
| // Add click handler to hyperlinks to send restful DELETE requests | |
| // | |
| // Example: | |
| // | |
| // <a href="/delete/1" class="rest-delete">delete</a> | |
| // <script>restful.init($('.rest-delete'));</script> | |
| // | |
| var restful = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class PhotoApiTest extends TestCase { | |
| public function setUp() | |
| { | |
| parent::setUp(); | |
| Route::enableFilters(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function($, undefined) { | |
| // Shorthand to make it a little easier to call public laravel functions from within laravel.js | |
| var laravel; | |
| $.laravel = laravel = { | |
| // Link elements bound by jquery-ujs | |
| linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]', | |
| // Select elements bound by jquery-ujs | |
| inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var o = $({}); | |
| $.subscribe = o.on.bind(o); | |
| $.publish = o.trigger.bind(o); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // more: http://baylorrae.com/php-pubsub/ | |
| class PubSub | |
| { | |
| private static $events = array(); // all subscriptions | |
| // Don't allow PubSub to be initialized outside this class |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function partial( fn /*, args...*/) { | |
| var aps = Array.prototype.slice, | |
| args = aps.call( arguments, 1 ); | |
| return function() { | |
| return fn.apply( this, args.concat( aps.call( arguments ) ) ); | |
| }; | |
| } | |
| // VERY BORING EXAMPLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| array_combine() — Creates an array by using one array for keys and another for its values (useful when reading from a CSV file - combine the header row with each subsequent line to create an associative array) | |
| fgetcsv() — Gets line from file pointer and parse for CSV fields | |
| register_shutdown_function() — Register a function for execution on shutdown | |
| stream_context_create() — Creates a stream context (perform a POST using file_get_contents) | |
| parse_url() — Parse a URL and return its components | |
| uniqid() — Generate a unique ID | |
| money_format() — Formats a number as a currency string | |
| wordwrap() — Wraps a string to a given number of characters | |
| Also, for anyone wondering, in the OP, mysql() is an alias of: |