When a PHP DateTime (or Carbon date) object is converted to JSON it is sent in a format that native JavaScript cannot parse, like this:
{
"date": "2015-09-10 14:09:46",
"timezone_type": 3,
"timezone": "UTC"
}| <?php | |
| class Student | |
| { | |
| public $firstName; | |
| public $lastName; | |
| public $cohort; | |
| public $classStart; |
| <?php | |
| class Ad { | |
| public $dbc; | |
| public $id; | |
| public $title = ''; | |
| public $body = ''; |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>JQuery, YAY!</title> | |
| </head> | |
| <body> | |
| <h1 id="heading" data-alt-heading="MAGIC">Example Page</h1> | |
| {{ link_to_action('PostsController@edit', 'Edit', $post->id, array('class' => 'btn btn-default')) }} | |
| <button type="button" class="btn btn-danger delete-btn" data-post-id="{{{ $post->id }}}">Delete</button> | |
| <script> | |
| var csrfToken = "{{{ Session::get('_token') }}}"; | |
| $(".delete-btn").click(function() { | |
| var postId = $(this).data('post-id'); | |
| if (confirm('Are you sure you want to delete this post?')) { |
| $(document).ready(function() { | |
| $(".collapse-column").each(function() { | |
| $(this).data('default-height', $(this).height()); | |
| $(this).height('80'); | |
| }); | |
| $(".collapse-column").click(function() { | |
| var targetHeight = $(this).data('default-height'); | |
| 2015-08-24 11:19:16 -0500 | |
| cmake | |
| . | |
| -DBOOST_INCLUDEDIR=/usr/local/opt/boost/include | |
| -DBOOST_LIBRARYDIR=/usr/local/opt/boost/lib | |
| -DCCLIENT_INCLUDE_PATH=/usr/local/opt/imap-uw/include/imap | |
| -DCMAKE_C_FLAGS=-I/usr/local/opt/readline/include -L/usr/local/opt/readline/lib | |
| -DCMAKE_CXX_FLAGS=-I/usr/local/opt/readline/include -L/usr/local/opt/readline/lib | |
| -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/hhvm/3.9.0 |
| <?php | |
| // app/controllers/PostsController.php | |
| class PostsController extends \BaseController | |
| { | |
| // ... | |
| public function destroy($id) | |
| { | |
| // ... |
When a PHP DateTime (or Carbon date) object is converted to JSON it is sent in a format that native JavaScript cannot parse, like this:
{
"date": "2015-09-10 14:09:46",
"timezone_type": 3,
"timezone": "UTC"
}| <?php | |
| class BaseModel { | |
| const UNIT_KM = 111.045; | |
| const UNIT_MI = 69.0; | |
| // Throw this function in any model with latitude/longitude columns | |
| // Or if multiple models have those values you can put it in your BaseModel | |
| public function scopeNearLatLong($query, $lat, $lng, $radius = 10, $unit = 69.0) | |
| { |
| "use strict"; | |
| var Hangman = { | |
| words: [], // Set of words for hangman to choose from | |
| currentWord: '', // Current word for the game | |
| correctGuesses: [], // Correct letters the user has guesses | |
| incorrectGuesses: [], // Wrong letters the user has guessed | |
| maxGuesses: 0, // Maximum number of wrong guesses the user is allowed | |
| /** |