Skip to content

Instantly share code, notes, and snippets.

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

musaid musaid

🏠
Working from home
View GitHub Profile
@musaid
musaid / postgres_queries_and_commands.sql
Created August 13, 2023 02:42 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
// Comments
++ -- /= && || ||=
-> => :: __
== === != =/=
<= >= <==>
/* */ // ///
\n \\
<< <<< <<= >> >>> >>= |= ^=
0xFF 1920x1080
@musaid
musaid / ExampleNotification.php
Created April 24, 2020 04:07 — forked from alejandrogih/ExampleNotification.php
Send email with Sendgrid (including template id and substitutions) with Laravel's notifications
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
//This example use the official's sendgrid php helper (https://github.com/sendgrid/sendgrid-php)
@musaid
musaid / docker-compose.yml
Created March 17, 2019 12:45
Sample Docker Compose File
version: '3'
services:
proxy:
container_name: proxy
image: jwilder/nginx-proxy
ports:
- 80:80
volumes:
$(function() {
$('#sortable').sortable({
start: function(event, ui) {
var start_pos = ui.item.index();
ui.item.data('start_pos', start_pos);
},
change: function(event, ui) {
var start_pos = ui.item.data('start_pos');
var index = ui.placeholder.index();
if (start_pos < index) {
@musaid
musaid / remove-processed.sql
Created October 7, 2018 04:25
Stored procedure to remove rows in chunks until a certain value is reached.
CREATE DEFINER=`admin`@`10.0.0.1` PROCEDURE `removeProcessed`(table_name VARCHAR(255), keyField VARCHAR(255), maxId INT, num_rows INT)
BEGIN
SET @table_name = table_name;
SET @keyField = keyField;
SET @maxId = maxId;
SET @num_rows = num_rows;
SET @sql_text1 = concat('SELECT MIN(',@keyField,') INTO @a FROM ',@table_name);
PREPARE stmt1 FROM @sql_text1;
EXECUTE stmt1;
@musaid
musaid / config.js
Last active October 31, 2018 10:34 — forked from 1Marc/config.js
My VS Code Config
// For: @musaid
// https://twitter.com/musaid/status/1039688749205020672
// Ligatures built into Operator Mono as "Operator Mono Lig" with https://github.com/kiliman/operator-mono-lig
// VS Code Extensions:
// Material Icon Theme (Philip Kief),
// indent-rainbow (oderwat),
// Rainbow Brackets (2gua),
// Subtle Match Brackets (Rafa Mel),
// Git Lense
// Prettier (Esben Petersen) (require config file with requireConfig)
@musaid
musaid / belongs-to-many.sublime-snippet
Last active August 28, 2018 03:07
Commonly used snippets for Sublime Text 3
<snippet>
<content><![CDATA[
public function ${1:relationship}()
{
return \$this->belongsToMany(${2:${1/^(.+)$/(?1\u$1:)/g}}::class${3:, '${4:table}'});
}
]]></content>
<tabTrigger>belm</tabTrigger>
<scope>source.php</scope>
</snippet>
@musaid
musaid / Dockerfile
Created April 8, 2018 04:46
Dockerfile musaid/apache:2.0.0
FROM ubuntu:16.04
# Set the env variable DEBIAN_FRONTEND to noninteractive
ARG DEBIAN_FRONTEND=noninteractive
ARG LC_ALL=C.UTF-8
# Set the locale
RUN apt-get clean && apt-get update && apt-get install -y locales
# Set the locale
@musaid
musaid / settings.json
Created March 4, 2018 02:20
VS Code Preferences
// Place your settings in this file to overwrite the default settings
{
"editor.fontFamily": "Operator Mono Lig Book, Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.renderWhitespace": "all",
"editor.fontSize": 13,
"terminal.integrated.fontSize": 12,
"terminal.integrated.fontFamily": "Monaco for Powerline",
"workbench.colorTheme": "Operator Mono Dark Theme",
"sublimeTextKeymap.promptV3Features": true,