Skip to content

Instantly share code, notes, and snippets.

View monaye's full-sized avatar

Monaye Win monaye

View GitHub Profile
@monaye
monaye / astro-build-customize.txt
Last active January 26, 2025 12:39
Astro Build Configuration to retain previous build soft link to dist
// set build output directory with date and soft link dis folder to the latest build date
date=$(date +%Y%m%d%H%M%S) && astro build --outDir build/$date && ln -sfn build/$date dist
@monaye
monaye / vim key binding
Created January 20, 2021 19:18
VIM Key Binding
"vim.normalModeKeyBindingsNonRecursive": [
{
"before": [
"J"
],
"after": [
"5",
"j"
]
},
@monaye
monaye / gist:4597a0817d82ec9d78ee542ec2f6700f
Created July 28, 2020 18:29
Mac .profile .zprofile .bash_profile
// ~/.profile
export PATH="$HOME/.composer/vendor/bin:$PATH"
// ~/.zprofile || ~/.bash_profile
source ~/.profile
@monaye
monaye / index.php
Created April 14, 2020 22:43
[Guzzule Mailhog Code Sample] #laravel #mailhog
$mailhog = new \GuzzleHttp\Client([
'base_uri' => 'http://127.0.0.1:8025'
]);
$emails = json_decode(
$mailhog
->get('/api/v1/messages')
->getBody()
->getContents()
@monaye
monaye / lua
Created December 11, 2018 16:07
HammerSpoon Key Modifer
local function keyCode(key)
return function() hs.eventtap.keyStroke({}, key) end
end
hs.hotkey.bind({"ctrl"}, 'h', keyCode('left'), nil, keyCode('left'))
hs.hotkey.bind({"ctrl"}, 'j', keyCode('down'), nil, keyCode('down'))
hs.hotkey.bind({"ctrl"}, 'k', keyCode('up'), nil, keyCode('up'))
hs.hotkey.bind({"ctrl"}, 'l', keyCode('right'), nil, keyCode('right'))
@monaye
monaye / scrollTo.js
Last active October 4, 2018 02:57
Add windows ScollTo event to all class
const targets = document.getElementsByClassName('smoothScroll');
const scrollToElement = function(event) {
event.preventDefault();
let elementId = event.target.attributes.href.value.replace('#', '');
let scrollPosition = document.getElementById(elementId).offsetTop;
@monaye
monaye / AppServiceProvider.php
Created October 1, 2018 13:09
Show Lalavel Query Details if passed in URL
if (env('APP_ENV') === 'local') {
\DB::connection()->enableQueryLog();
\Event::listen('kernel.handled', function ($request, $response) {
if ( $request->has('sql-debug') ) {
$queries = \DB::getQueryLog();
dd($queries);
}
});
}
@monaye
monaye / automatically-set-application-locale.php
Created July 2, 2018 00:38 — forked from paulund/automatically-set-application-locale.php
Automatically Detect Browser Language With PHP
<?php
$supportedLangs = array('en-GB', 'fr', 'de');
$languages = explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
foreach($languages as $lang)
{
if(in_array($lang, $supportedLangs))
{
@monaye
monaye / update.sql
Created April 12, 2018 03:04
Update column value based on same table's row of other column value
UPDATE
tableA
SET
columnA = SUB.columnB
FROM
( select id, columnB FROM tableA ) as SUB
WHERE
tableA.id = SUB.id;
@monaye
monaye / .htaccess
Created February 26, 2018 03:04 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/