Skip to content

Instantly share code, notes, and snippets.

View bonniss's full-sized avatar
🥐
Cancer - Croissant

Dan Teddy bonniss

🥐
Cancer - Croissant
View GitHub Profile

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@bonniss
bonniss / postgres-cheatsheet.md
Created April 12, 2019 07:00 — forked from Kartones/postgres-cheatsheet.md
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)
@bonniss
bonniss / my-psql-common.md
Last active August 13, 2022 21:19
PSQL Common Lines

Installation

Chocolatey

choco install postgresql13 --params '/Password:159753 /Port:5432'
psql -Upostgres
ALTER USER postgres WITH PASSWORD 'new_password';
@bonniss
bonniss / .gitignore
Created April 25, 2019 22:29 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@bonniss
bonniss / bootstrap-4-sass-mixins-cheat-sheet.scss
Created May 5, 2019 11:03 — forked from anschaef/bootstrap-4-sass-mixins-cheat-sheet.scss
Bootstrap 4 Sass Mixins [Cheat sheet with examples]
/* -------------------------------------------------------------------------- */
// All Bootstrap 4 Sass Mixins [Cheat sheet]
// Updated to Bootstrap v4.1.x
// @author https://anschaef.de
// @see https://github.com/twbs/bootstrap/tree/v4-dev/scss/mixins
/* -------------------------------------------------------------------------- */
// Grid variables
$grid-columns: 12 !default;
$grid-gutter-width: 30px !default;
@bonniss
bonniss / RESTApplication.java
Created May 12, 2019 06:56 — forked from brunocribeiro/RESTApplication.java
Set of configuratons to enable CORS in AngularJS with Java Environments
package com.brunocesar.config;
import java.io.IOException;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerResponseContext;
import javax.ws.rs.container.ContainerResponseFilter;
import javax.ws.rs.ext.Provider;
@Provider
/**
* Print Stylesheet fuer Deinewebsite.de
* @version 1.0
* @lastmodified 16.06.2016
*/
@media print {
/* Inhaltsbreite setzen, Floats und Margins aufheben */
/* Achtung: Die Klassen und IDs variieren von Theme zu Theme. Hier also eigene Klassen setzen */
@bonniss
bonniss / base64.js
Created July 14, 2019 03:36 — forked from cawa87/base64.js
JavaScript Convert an image to a base64 url
/**
* Convert an image
* to a base64 url
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat=image/png]
*/
function convertImgToBase64URL(url, callback, outputFormat){
var img = new Image();
img.crossOrigin = 'Anonymous';
@bonniss
bonniss / nodejs-cheatsheet.js
Created August 20, 2019 04:28 — forked from LeCoupa/nodejs-cheatsheet.js
Complete Node.js CheatSheet --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
/* *******************************************************************************************
* THE UPDATED VERSION IS AVAILABLE AT
* https://github.com/LeCoupa/awesome-cheatsheets
* ******************************************************************************************* */
// 0. Synopsis.
// http://nodejs.org/api/synopsis.html
@bonniss
bonniss / scraper.js
Created August 28, 2019 08:33 — forked from veb/scraper.js
Scrapes the main page of HackerNews and returns an array of objects using Puppeteer and Cheerio
const puppeteer = require('puppeteer');
const cheerio = require('cheerio');
async function run() {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://news.ycombinator.com');
let content = await page.content();
var $ = cheerio.load(content);