Skip to content

Instantly share code, notes, and snippets.

View thexdev's full-sized avatar
🧬
Experiment

M. Akbar Nugroho thexdev

🧬
Experiment
View GitHub Profile
@thexdev
thexdev / pancake-flying-animation.css
Created February 23, 2022 08:50
The flying effect of Pancakeswap bunny on hero section
@keyframes flyingAnimation {
from {
transform: translate(0, 0px);
}
50% {
transform: translate(-5px, -5px);
}
to {
transform: translate(0, 0px);
}
@thexdev
thexdev / text2binary.js
Created January 30, 2020 11:06
JavaScript function to convert plain text to binary
const text2binary = (text = "") => {
return text === ""
? text
: text
.split("")
.map(char => `${char.charCodeAt(0).toString(2)} `)
.join("");
};
@thexdev
thexdev / binary2text.js
Last active January 30, 2020 11:08
JavaScript function to convert binary text to plain text
const binary2text = (binaryText = "") => {
return binaryText === ""
? binaryText
: binaryText
.split(" ")
.map(binary => parseInt(binary, 2))
.map(number => String.fromCharCode(number))
.join("");
};
@thexdev
thexdev / ci-htaccess
Created December 29, 2019 04:32
htaccess rewrite url to removing index.php on codeigniter 3
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
@thexdev
thexdev / store-command-output-into-file.sh
Created December 17, 2019 12:26
Insert the output of your bash command into a file (you can choose the specific file extention too)
# 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
@thexdev
thexdev / position-and-center-image.css
Created December 13, 2019 16:54
Position and center the image to scale nicely on all screens
.hero-image {
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
@thexdev
thexdev / css-darker-background-effect.css
Last active December 13, 2019 16:52
Add darker background effect to the image
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("photographer.jpg");
@thexdev
thexdev / php-mysql-datetime-format.php
Last active December 12, 2019 13:38
PHP date function syntax to fill the value in mysql datetime column.
<?php
$now = date("Y-m-d H:i:s");
@thexdev
thexdev / bg-img-with-gradient-overlay.css
Last active December 12, 2019 17:01
CSS snippet to make a background image with gradient color overlay
#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');
}
@thexdev
thexdev / system-tmp-directory.php
Last active October 22, 2023 19:23
Solve CodieIgniter error with message: mkdir(): Invalid path and Filename: drivers/Session_files_driver.php. This usually happen on mac.
<?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;