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 *foo(x) { | |
var y = 2 * (yield (x + 1)); | |
var z = yield (y / 3); | |
return (x + y + z); | |
} | |
var it = foo( 5 ); | |
// note: not sending anything into `next()` here | |
console.log( it.next() ); // { value:6, done:false } |
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 getTweets (uid) { | |
return fetch('https://api.users.com/' + uid) | |
.then((response) => { | |
return response.json() | |
}) | |
.then((response) => { | |
return response.data | |
}).then((tweets) => { | |
return tweets.filter((tweet) => { | |
return tweet.stars > 50 |
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
After doing some code changes on master local branch | |
you just have type following commands and you will create | |
new remote branch out of code changes | |
git checkout -b <new-branch-name> | |
git add . | |
git commit -m <new-branch-name> | |
git push -u origin <new-branch-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
async function getFirstUser() { | |
//getUsers() returns Promise | |
let users = await getUsers(); | |
return users[0].name; | |
} | |
let user = await getFirstUser(); |
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
USE [master] | |
GO | |
CREATE DATABASE [GDPRBCK] ON | |
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL13.GDPR\MSSQL\DATA\GDPRBCK.mdf' ), | |
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL13.GDPR\MSSQL\DATA\GDPRBCK_log.ldf' ) | |
FOR ATTACH | |
GO |
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
1. Start mongo without authentication | |
`mongod --port 27017 --dbpath /data/db1` | |
2. Run mongo shell | |
`mongo --port 27017` | |
3. Run following command to give admin user root priviliges | |
use admin | |
db.createUser( | |
{ |
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
You can use folowing system stored procedures to get some info about SQL server mail accounts and profiles: | |
EXEC msdb.dbo.sysmail_help_configure_sp; | |
EXEC msdb.dbo.sysmail_help_account_sp; | |
EXEC msdb.dbo.sysmail_help_profile_sp; | |
EXEC msdb.dbo.sysmail_help_profileaccount_sp; | |
EXEC msdb.dbo.sysmail_help_principalprofile_sp; | |
The following example creates a Database Mail account and a Database Mail profile. | |
The example then adds the account to the profile and grants access to the profile to the DBMailUsers database role in the msdb database. | |
-- Create a Database Mail account |
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
# This will destroy any local modifications. | |
# Don't do it if you have uncommitted work you want to keep. | |
git reset --hard 0d1d7fc32 | |
# Alternatively, if there's work to keep: | |
git stash | |
git reset --hard 0d1d7fc32 | |
git stash pop | |
# This saves the modifications, then reapplies that patch after resetting. | |
# You could get merge conflicts, if you've modified things which were |
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
UserSchema.pre("save", function(next) { | |
var user = this; | |
// only hash the password if it has been modified (or is new) | |
if (!user.isModified("password")) return next(); | |
// generate a salt | |
bcrypt.genSalt(SALT_WORK_FACTOR, function(err, salt) { | |
if (err) return next(err); | |
// hash the password using our new salt | |
bcrypt.hash(user.password, salt, function(err, hash) { |
OlderNewer