Skip to content

Instantly share code, notes, and snippets.

View smfhashmi's full-sized avatar
💭
code :)

hashmi smfhashmi

💭
code :)
  • hyderabad
  • 06:20 (UTC +05:30)
View GitHub Profile
@smfhashmi
smfhashmi / user.js
Created January 16, 2018 13:41 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
@smfhashmi
smfhashmi / download-site.md
Created November 15, 2017 06:51 — forked from pmeinhardt/download-site.md
download an entire page (including css, js, images) for offline-reading, archiving… using wget

If you ever need to download an entire website, perhaps for off-line viewing, wget can do the job — for example:

$ wget --recursive --no-clobber --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains website.org --no-parent  www.website.org/tutorials/html/

This command downloads the website www.website.org/tutorials/html/.

The options are:

  • --recursive: download the entire website
  • --domains website.org: don't follow links outside website.org
@smfhashmi
smfhashmi / postgres-cheatsheet.md
Last active November 13, 2017 13:16 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

sudo su - postgres

psql

CREATE USER deploy PASSWORD 'deploy';

ALTER USER deploy CREATEDB;

connect Database psql dbname user;