Skip to content

Instantly share code, notes, and snippets.

View sas1ni69's full-sized avatar

Hassanin Ahmed sas1ni69

View GitHub Profile
#!/usr/bin/env bash
# Abort sign off on any error
set -e
# Start the benchmark timer
SECONDS=0
# Repository introspection
OWNER=$(gh repo view --json owner --jq .owner.login)
import { Controller } from "@hotwired/stimulus"
import SignaturePad from 'signature_pad'
export default class extends Controller {
static targets = ["canvas", "input"]
connect() {
this.signaturePad = new SignaturePad(this.canvasTarget)
this.signaturePad.addEventListener("endStroke", this.endStroke)
this.resizeCanvas()
if (this.inputTarget.value) {
@benregn
benregn / debug_postgres_locks.md
Created May 9, 2019 15:11
Debugging stuck queries in postgres (lock)
@0xjac
0xjac / private_fork.md
Last active June 28, 2024 19:27
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@paradigm314
paradigm314 / console.rb
Created September 7, 2016 20:26
Rails 4 generate scaffolding in admin namespace
# Run In Console
rails g model Foo
rails g scaffold_controller Admin::Foo --model-name=Foo
# Generates
# db/migrate/20160907201951_create_foo.rb
# app/models/foo.rb
# app/controllers/admin/foo_controller.rb
# app/views/admin/foo
# app/views/admin/foo/index.html.erb
@apolloclark
apolloclark / postgres cheatsheet.md
Last active June 14, 2024 08:25
postgres cheatsheet

Postgres Cheatsheet

This is a collection of the most common commands I run while administering Postgres databases. The variables shown between the open and closed tags, "<" and ">", should be replaced with a name you choose. Postgres has multiple shortcut functions, starting with a forward slash, "". Any SQL command that is not a shortcut, must end with a semicolon, ";". You can use the keyboard UP and DOWN keys to scroll the history of previous commands you've run.

Setup

installation, Ubuntu

http://www.postgresql.org/download/linux/ubuntu/ https://help.ubuntu.com/community/PostgreSQL

@adambray89
adambray89 / Mobile Friendly HTML 5 and CSS 3 Responsive Fixed Navigation Menu.markdown
Created May 22, 2015 23:10
Mobile Friendly HTML 5 and CSS 3 Responsive Fixed Navigation Menu

Mobile Friendly HTML 5 and CSS 3 Responsive Fixed Navigation Menu ('-' * 65) A mobile first flexbox navigation menu with a responsive design that works seamlessly with a mobile drop down menu.

A Pen by lawnch on CodePen.

License.

@AllThingsSmitty
AllThingsSmitty / script-loaded.js
Created May 5, 2015 13:25
Check if any given script has loaded
var myScript = document.createElement('script');
myScript.src = 'http://code.jquery.com/jquery-2.1.4.min.js';
myScript.onload = function() {
console.log('jQuery loaded.');
};
document.body.appendChild(myScript);
@monsteronfire
monsteronfire / node-npm-no-sudo
Last active January 14, 2016 09:49
node-and-npm-no-sudo (reference: https://gist.github.com/isaacs/579814)
#installing node in a custom directory so you don't have to use sudo all the time
#npm now comes with node, so no need to individually install it
cd ~
mkdir local
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.zshrc
. ~/.zshrc
cd local