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
namespace AdapterPattern { | |
export class Adaptee { | |
public method(): void { | |
console.log("`method` of Adaptee is being called"); | |
} | |
} | |
export interface Target { | |
call(): void; |
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
namespace AbstractFactoryPattern { | |
export interface AbstractProductA { | |
methodA(): string; | |
} | |
export interface AbstractProductB { | |
methodB(): number; | |
} | |
export interface AbstractFactory { | |
createProductA(param?: any) : AbstractProductA; |
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
.row:before { | |
content:''; | |
width:100%; | |
height:100%; | |
position:absolute; | |
left:0; | |
top:0; | |
background:linear-gradient(transparent 150px, white); | |
} |
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
type PartiallyRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>; | |
interface Human { | |
name: string; | |
age?: number; | |
} | |
type HumanWithRequiredAge = PartiallyRequired<Human, "age">; | |
const dan: HumanWithRequiredAge = { |
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
curl --location --request POST 'https://YOUR_AUTH0_DOMAIN/oauth/token' \ | |
--header 'Content-Type: application/x-www-form-urlencoded' \ | |
--data-urlencode 'client_id=YOUR_AUTH0_CLIENT_ID' \ | |
--data-urlencode 'username=YOUR_USERNAME' \ | |
--data-urlencode 'password=YOUR_PASSWORD' \ | |
--data-urlencode 'grant_type=password' \ | |
--data-urlencode 'scope=openid' |
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
pg_restore --dbname <DATABASENAME> --host localhost --port 5432 --username <USERNAME> --clean --schema public <RESTORE_FILE_LOCATION> |
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
PGPASSWORD="PASSWORD" pg_dump -U USER_NAME -h 127.0.0.1 -p 5432 DATABASE_NAME > DATABASE_NAME-$(date +%d-%m-%Y_%H-%M-%S).sql |
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
const createDataTree = dataset => { | |
const hashTable = Object.create(null); | |
dataset.forEach(aData => hashTable[aData.ID] = {...aData, childNodes: []}); | |
const dataTree = []; | |
dataset.forEach(aData => { | |
if(aData.parentID) hashTable[aData.parentID].childNodes.push(hashTable[aData.ID]) | |
else dataTree.push(hashTable[aData.ID]) | |
}); | |
return dataTree; | |
}; |
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
select * from yourTable ou | |
where (select count(*) from yourTable inr | |
where inr.sid = ou.sid) > 1 |
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
import 'dart:isolate'; | |
void main() async{ | |
ReceivePort receivePort= ReceivePort(); | |
/* | |
Create new Isolate, just after creating new Isolate control of this main Isolate, | |
start executing next instructions below the new Isolate creation line, | |
where as new Isolate keep working in parallel of main/other Isolates |
NewerOlder