The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function.
This file contains hidden or 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
| #include "card.h" | |
| #include <sstream> | |
| namespace playing_cards { | |
| Card::Card(int value, Suit suit) : value_(value), suit_(suit) {} | |
| Card::Card(const Card& o) : value_(o.value_), suit_(o.suit_) {} | |
| Card::~Card() {} |
This file contains hidden or 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
| # aproducer.py | |
| # | |
| # Async Producer-consumer problem. | |
| # Challenge: How to implement the same functionality, but no threads. | |
| import time | |
| from collections import deque | |
| import heapq | |
| class Scheduler: |
This file contains hidden or 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 * as Sentry from "@sentry/node"; | |
| import imagemin from "imagemin"; | |
| import mozjpeg from "imagemin-mozjpeg"; | |
| import sharp from "sharp"; | |
| import isJpg from "is-jpg"; | |
| import * as aws from "aws-sdk"; | |
| import { Upload } from "../../types/graphqlUtils"; | |
| import { generateFilename } from "./generateFilename"; | |
| export const s3 = new aws.S3({ |
This file contains hidden or 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 sys | |
| import socket | |
| import select | |
| import random | |
| from itertools import cycle | |
| # dumb netcat server, short tcp connection | |
| # $ ~ while true ; do nc -l 8888 < server1.html; done | |
| # $ ~ while true ; do nc -l 9999 < server2.html; done | |
| SERVER_POOL = [('10.157.0.238', 8888)] |
This file contains hidden or 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
| #include <complex> | |
| #include <iostream> | |
| #include <valarray> | |
| #include <vector> | |
| using namespace std; | |
| const double PI = 3.141592653589793238460; | |
| typedef std::complex<double> Complex; | |
| typedef std::valarray<Complex> CArray; |
This file contains hidden or 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 sendgrid = require('sendgrid'); | |
| const helper = sendgrid.mail; | |
| const keys = require('../config/keys'); | |
| class Mailer extends helper.Mail { | |
| constructor({ subject, recipients }, content) { | |
| super(); | |
| this.sgApi = sendgrid(keys.sendGridKey); | |
| this.from_email = new helper.Email('no-reply@emaily.com'); |
This file contains hidden or 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
| Install Termux App. | |
| type "apt update" | |
| Then We have to install a text editor to write our code so type "apt install vim" for vim text editor | |
| or u can also use nano text editor for nano type "apt install nano" | |
| Now Clang Installation type "apt install clang" and wait for download completes. | |
| now to create a file simply type vim filename.c or .cpp or nano filename.c or cpp | |
| then u will able to write ur code . | |
| write.....to save ur code simply press esc then type ":wq" | |
| now code is ready to compile | |
| type "clang filename.c -o filename" |
NewerOlder
