Skip to content

Instantly share code, notes, and snippets.

View dodycode's full-sized avatar
🏠
Working from home

Dody dodycode

🏠
Working from home
View GitHub Profile
@ArcRanges
ArcRanges / gist.md
Last active April 28, 2024 14:30
aws-ec2-nextjs

Instructions to properly set up a production-ready NextJS App with AWS

This is a summary of how to start your own NextJS app, create the repo on Github, upload later in an AWS EC2 Instance and automate the process with AWS Codebuild, CodeDeploy, & CodePipeline.

After following these instructions you should be able to:

  • Create a NextJS App
  • Create an AWS EC2 instance
  • Be able to SSH to an EC2 instance
  • Prepare the instance as a Node environment
  • Configure Nginx service for proper routing
  • Configure domain and add SSL
@jaames
jaames / astro.config.mjs
Created January 3, 2022 15:14
Injecting global SCSS variables in Astro (https://astro.build), using additionalData and a path alias
import { fileURLToPath } from 'url';
import path, { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
export default {
// all the usual config goes here...
@statico
statico / useModals.tsx
Created December 19, 2021 18:26
Chakra UI await-able alert, confirm, and prompt modal dialogs
/*
* Usage:
* const { alert, confirm, prompt } = useModals()
* alert("Hey!") // awaitable too
* if (await confirm("Are you sure?")) ...
* const result = await prompt("Enter a URL", "http://")
*/
import React, {
createContext,
@sonnylazuardi
sonnylazuardi / CounterReact.jsx
Created August 13, 2021 06:52
Astro React Vue. Global State Management: Zustand
import React from "react";
import { useStore } from "./store";
export default function CounterReact({ demo }) {
const state = useStore((state) => state);
let add = () => {
state.inc();
};
version: '2'
services:
mariadb:
image: mariadb
volumes:
- /srv/Configs/Databases/Moodle:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=moodle
- MYSQL_ROOT_USER=root
- MYSQL_DATABASE=moodle
@zgunz42
zgunz42 / bulkdns.js
Created December 12, 2020 05:53
bulk delete dns record cloudflare
const axios = require('axios').default;
const _ = require('lodash');
const email = '<email>';
const key = '<global_key>';
const zone = '<zone>'
const url = `https://api.cloudflare.com/client/v4/zones/${zone}/dns_records`
function deleteRec(dns) {
@robby250
robby250 / skin.ini conversion.md
Last active October 3, 2023 05:30
Convert osu skins to quaver
@kresnasatya
kresnasatya / browser-check.js
Last active March 23, 2019 12:38
How to detect browser and it's version using UA-Parser (User Agent Parser)
// First, put UA-Parser-JS CDN
<script src="https://cdn.jsdelivr.net/npm/ua-parser-js@0/dist/ua-parser.min.js"></script>
<script>
// Second, instantiate UAParser
const parser = new UAParser();
const parserResult = parser.getResult();
const browserName = parserResult.browser.name;
const browserVersion = parseInt(parserResult.browser.version.split('.')[0], 10);
let STANDARD_VERSION;
console.log(parserResult);
@akexorcist
akexorcist / index.js
Last active November 17, 2022 11:25
Axios post method requesting with x-www-form-urlencoded content type. See https://axios-http.com/docs/urlencoded
const axios = require('axios')
/* ... */
const params = new URLSearchParams()
params.append('name', 'Akexorcist')
params.append('age', '28')
params.append('position', 'Android Developer')
params.append('description', 'birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/')
params.append('awesome', true)
@tisuchi
tisuchi / invoice-number-generate.php
Last active July 29, 2022 13:22
How to generate Invoice Number with Laravel
<?php
//IT SHOULD BE INSIDE YOUR MEHTOD
//get last record
$record = RecordModel::latest()->first();
$expNum = explode('-', $record->invoiceno);