This file contains 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
//add this to /vendor/laravel/framework/src/Illuminate/Support/helpers.php | |
if (! function_exists('da')) { | |
/** | |
* Dump the passed variables to array and end the script. | |
* | |
* @param mixed | |
* @return void | |
*/ | |
function da() |
This file contains 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
// ******************* Scroll to element's position | |
//get parameters are iteration of all objects selected by .selection | |
$(".selection").get(0).scrollIntoView(); | |
// ******************* Check if checkbox is checked | |
$(".checkbox").on("change", function () { | |
if ($(this).is(":checked")) { | |
doSomething(); | |
} else { | |
doSomething(); |
This file contains 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
let person = { | |
_name: 'Lu Xun', | |
_age: 137, | |
set age(newAge) { | |
if (typeof newAge === 'number') { | |
this._age = newAge; | |
} else { | |
return 'Invalid input' | |
} | |
}, |
This file contains 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
//declare class | |
class Surgeon { | |
//define constructor method - things that will be done on instantiation ('new') | |
constructor(name, department) { //when 'new-ing' instance of this class, expect 'name' and 'department' arguments | |
//we use underscore to define properties that aren't supposed to be acccessed directly | |
this._name = name; | |
this._department = department; | |
this._remainingVacationDays = 20; | |
} | |
//getter method - name as the property, but without underscore. This will be called with object.name |
This file contains 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
class HospitalEmployee { | |
constructor(name) { | |
this._name = name; | |
this._remainingVacationDays = 20; | |
} | |
static generatePassword(){ | |
return Math.floor(Math.random()*10000); | |
} | |
This file contains 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
//Initialize your project using npm init (in project folder) and create a directory called src | |
//Install babel dependencies by running | |
npm install babel-cli -D | |
npm install babel-preset-env -D | |
//Create a .babelrc file inside your project and add the following code inside it: | |
{ | |
"presets": ["env"] | |
} | |
//Add the following script to your scripts object in package.json: | |
"build": "babel src -d lib" |
This file contains 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 artisan make:migration create_users_table --create=users | |
php artisan migrate | |
# To rollback the latest migration operation, you may use the rollback command. This command rolls back the last "batch" of migrations, which may include multiple migration files: | |
php artisan migrate:rollback | |
#The migrate:reset command will roll back all of your application's migrations: | |
php artisan migrate:reset |
This file contains 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
# Create repo @BitBucket | |
# cd /path/to/local/folder | |
git init | |
git add . | |
git remote add origin https://username@bitbucket.org/username/repo.git | |
git commit -m "Initial" | |
git push -u origin master |
This file contains 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() { | |
getSomething().done(function() { | |
$("#success-alert").show(); | |
}).fail(function() { | |
$("#fail-alert").show(); | |
}); | |
}); |
This file contains 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
// fadeIn | |
$('.selection').css({opacity: 0.0, visibility: "visible"}).animate({opacity: 1.0}); | |
// fadeOut | |
$('.selection').css({opacity: 1.0, visibility: "visible"}).animate({opacity: 0}); |
OlderNewer