Skip to content

Instantly share code, notes, and snippets.

View kahramanX's full-sized avatar
🧿

Kahraman kahramanX

🧿
  • Turkey, Izmir
  • 16:45 (UTC +03:00)
View GitHub Profile
@miguelmota
miguelmota / nodejs-directory-structure.md
Last active December 2, 2023 08:47
Node.js MVC directory structure example.
Node.js MVC directory structure example.
├── app
│   ├── controllers
│   │   ├── admin
│   │   │   ├── posts.js
│   │   │   └── users.js
│   │   ├── posts.js
│ │ ├── session.js
@Kartones
Kartones / postgres-cheatsheet.md
Last active November 15, 2024 21:14
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@joelrojo
joelrojo / ajax_cheat_sheet.md
Last active August 5, 2024 11:56
AJAX 101 cheat sheet

#AJAX

What is AJAX

"AJAX an acronym for asynchronous JavaScript and XML is a group of interrelated web development techniques used on the client-side to create asynchronous web applications. With Ajax, web applications can send data to, and retrieve data from, a server asynchronously (in the background) without interfering with the display and behavior of the existing page. Data can be retrieved using the XMLHttpRequest object. Despite the name, the use of XML is not required (JSON is often used instead), and the requests do not need to be asynchronous." - wikipedia

AJAX with jQuery

jQuery provides a $.ajax() method with a set of options for sending requests and callback methods to handle responses.

  • Here is the most basic $.ajax() request that does not send any data. It will be handled by the post '/trips' route on the server. You can choose any of the http request verbs for the type parameter (get, post, put, delete)
@magalhini
magalhini / node-multiple-calls-render.js
Last active December 8, 2021 10:25
Example on how to render multiple responses into a route in node.js
const express = require('express')
const app = express()
const path = require('path')
const fetch = require('node-fetch')
const PORT = process.env.PORT || 3000
app.get('/api/user', (req, res) => {
res.json({ name: 'Richard' });
});
@kangmasjuqi
kangmasjuqi / longest sql queries #2.txt
Last active August 1, 2024 12:35
longest sql queries #2
### the longest sql queries I've ever made in 2016
### QUERY 2
select table_keuangan.*, dzohir_target,dzohir_realisasi,dzohir_percentage,dzohir_satkeg
from
(
select __is_kegiatan.description as nmitem, table_data.*,
((anggaran_realisasi/anggaran_pagu)*100) as anggaran_percentage
from __is_kegiatan
join (