'123abc' == 123 // True
'123abc' === 123 // False
echo true; // 1
echo false; // blank return
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
| $router->bind('username', function ($username) { | |
| return User::whereUsername($username)->firstOrFail(); | |
| }); |
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 | |
| namespace App\Console\Commands; | |
| use Illuminate\Foundation\Console\ModelMakeCommand as Command; | |
| class ModelMakeCommand extends Command | |
| { | |
| /** | |
| * Get the default namespace for the 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
| var parser = document.createElement('a'); | |
| parser.href = "http://example.com:3000/pathname/?search=test#hash"; | |
| parser.protocol; // => "http:" | |
| parser.hostname; // => "example.com" | |
| parser.port; // => "3000" | |
| parser.pathname; // => "/pathname/" | |
| parser.search; // => "?search=test" | |
| parser.hash; // => "#hash" | |
| parser.host; // => "example.com:3000" |
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
| # Redirect WWW to non-WWW | |
| server { | |
| listen 80; | |
| server_name www.example.org; | |
| return 301 $scheme://example.org; | |
| } | |
| # Non-WWW Block | |
| server { |
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
| // Via element properties | |
| $('something').click(event) { | |
| event.preventDefault(); | |
| // Disable this button | |
| $(this).prop('disabled', true); | |
| // Do something | |
| ... | |
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
| $.ajax({ | |
| type : 'post', | |
| url : '<URL>', | |
| data: { | |
| data : $('something').val() | |
| }, | |
| success : function(data) { | |
| }, | |
| error : function(data) { |
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
| Check out http://www.shawnmayzes.com/code/php/stripe/stripe-api for more information. | |
| <script type="text/javascript" src="https://js.stripe.com/v2/"></script> | |
| jQuery(function($) { | |
| $('form').submit(function(event) { | |
| var $form = $(this); | |
| $('input[type=submit]').prop('disabled', true); // Disable the submit button from being clicked multiple times |
NewerOlder