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 text2binary = (text = "") => { | |
return text === "" | |
? text | |
: text | |
.split("") | |
.map(char => `${char.charCodeAt(0).toString(2)} `) | |
.join(""); | |
}; |
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 binary2text = (binaryText = "") => { | |
return binaryText === "" | |
? binaryText | |
: binaryText | |
.split(" ") | |
.map(binary => parseInt(binary, 2)) | |
.map(number => String.fromCharCode(number)) | |
.join(""); | |
}; |
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
# Here i'm trying to extract detailed information | |
# on the hardware configuration of my computer | |
# with html format then display it to the browser. | |
sudo lshw -html > index.html && firefox index.html |
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
.hero-image { | |
background-position: center; | |
background-repeat: no-repeat; | |
background-size: cover; | |
position: relative; | |
} |
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
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("photographer.jpg"); |
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
<?php | |
$now = date("Y-m-d H:i:s"); |
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
#bg-img-overlay { | |
background-image: | |
linear-gradient( | |
to right, | |
rgba(15, 12, 41, 0.7), | |
rgba(48, 43, 99, 0.7), | |
rgba(36, 36, 62, 0.7) | |
), | |
url('https://source.unsplash.com/random/800x600'); | |
} |
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
<?php | |
defined('BASEPATH') OR exit('No direct script access allowed'); | |
$config['sess_driver'] = 'files'; | |
$config['sess_cookie_name'] = 'ci_session'; | |
$config['sess_expiration'] = 7200; | |
$config['sess_save_path'] = sys_get_temp_dir(); | |
$config['sess_match_ip'] = FALSE; | |
$config['sess_time_to_update'] = 300; | |
$config['sess_regenerate_destroy'] = FALSE; |
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
/** | |
* Bubble sorting algorithm in JavaScript. | |
* | |
* Here i'm using arrow function and ES6, but you can use native function and ES5 instead. | |
* | |
* @param {array} arr Unsorted Array | |
* @return {array} | |
*/ | |
const bubbleSort = arr => { | |
let swapped; |
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 React from "react"; | |
const Forward = React.forwardRef((props, ref: React.Ref<HTMLDivElement>) => ( | |
<div ref={ref} style={{ width: "100%", height: "30px", backgroundColor: "green" }} /> | |
)); | |
function ForwardRef() { | |
const divRef = React.useRef<HTMLDivElement>(null); | |
React.useEffect(() => { |
NewerOlder