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 | |
class Palindrome { | |
public $words; | |
public $regex = '/[^A-Za-z0–9]/'; | |
public $reserved; | |
public function __construct( $words) | |
{ |
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 | |
class Router{ | |
public $get = []; //when get routes are defined it is save here | |
public $post = []; // post routes are saved when when defined | |
//make a function that defined get routes | |
public function get($url, $controller) { | |
$this->get[$url] = $controller; // push url and controller to get property array | |
} |
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
// JOGGLING ASYNC | |
var http = require('http'); | |
var urls = [process.argv[2], process.argv[3], process.argv[4]]; | |
var count = 0; | |
var arr = []; | |
function get(a) { | |
http.get(urls[a], (res) => { |
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
var net = require('net'); | |
var date = new Date(); | |
var y = date.getFullYear(); | |
var m = zeroCheck(date.getMonth() + 1); | |
var d = zeroCheck(date.getDate()); | |
var h = zeroCheck(date.getHours()); | |
var min = zeroCheck(date.getMinutes()); |
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
var http = require('http'); | |
var fs = require('fs'); | |
var server = http.createServer(function (req, res) { | |
res.writeHead(200, { 'content-type': 'text/plain' }) | |
fs.createReadStream(process.argv[3]).pipe(res); | |
}) | |
server.listen(process.argv[2]); |
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
var http = require('http'); | |
var server = http.createServer(function (req, res) { | |
var body = ""; | |
res.writeHead(200, { 'content-type': 'text/plain' }); | |
if(req.method != 'POST') { | |
return res.end('Please send a POST\n') | |
} | |
req.on('data', (data) => { |
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
var http = require('http'); | |
var url = require ('url'); | |
var timestamp = (time) => { | |
return Date.parse(time) | |
} | |
var unixTimestamp = (time) => { | |
return { | |
unixtime: timestamp(time) | |
} |
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 encrypt(str, num) { | |
let len = str.substring(num, str.length - num).length; | |
let goin = '*'.repeat(len); | |
let res = str.slice(0, num) + goin + str.slice(str.length - num); | |
return res; | |
} | |
console.log(encrypt('111111111111111111111111111', 4)); // 1111*******************1111 | |
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 | |
function encrypt($str, $num){ | |
$len = strlen(substr($str, $num, strlen($str) - $num)); | |
$goin = str_repeat('*', $len); | |
$res = substr($str, 0 , $num) .$goin . substr($str, $len, strlen($str)); | |
return $res; | |
} |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>Document</title> | |
</head> | |
<body> | |
<div title="ok" id="oked"></div> |
OlderNewer