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
// Function to replace substrings | |
function replaceText(input) { | |
// Define a map of substrings to their replacements | |
const dictionary = { | |
'fren': 'friend', | |
'ngmi': 'wagmi', | |
'rekt': 'screwed', | |
'rug': 'sbf' | |
}; |
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
Open Command Prompt (cmd.exe) | |
In the terminal window, type: | |
reg.exe add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve | |
Restart Windows Explorer or the whole computer. |
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}); |
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
# 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
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
//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
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
//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
let person = { | |
_name: 'Lu Xun', | |
_age: 137, | |
set age(newAge) { | |
if (typeof newAge === 'number') { | |
this._age = newAge; | |
} else { | |
return 'Invalid input' | |
} | |
}, |
NewerOlder