Skip to content

Instantly share code, notes, and snippets.

View alpharder's full-sized avatar
:shipit:

Alex Bolshakov alpharder

:shipit:
View GitHub Profile
@paulomcnally
paulomcnally / subdomain.js
Last active March 6, 2019 13:31
Create file server/boot/subdomain.js and edit server/model-config.json to add "tenant": true property on every model. Only work with loopback-connector-postgresql and schema.
'use strict';
var modelConfig = require('../model-config.json');
module.exports = function(app) {
app.use(function(req, res, next) {
// set tenant based subdomain or use public
var subdomain = (req.subdomains.length > 1) ? req.subdomains.pop() : req.subdomains[0];
var tenant = req.subdomains.pop() || 'public';
@runspired
runspired / form.html
Created May 23, 2016 13:46
How to turn off password and email/username autocomplete.
<!--
<form autocomplete="off"> will turn off autocomplete for the form in most browsers
except for username/email/password fields
-->
<form autocomplete="off">
<!-- fake fields are a workaround for chrome/opera autofill getting the wrong fields -->
<input id="username" style="display:none" type="text" name="fakeusernameremembered">
<input id="password" style="display:none" type="password" name="fakepasswordremembered">
@tom--
tom-- / Random bytes, ints, UUIDs in PHP.md
Last active February 11, 2023 06:14
PHP random bytes, integers and UUIDs

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@kfstorm
kfstorm / vmoptions
Created June 11, 2015 05:24
IntelliJ IDEA font rendering options for Windows
-Dawt.useSystemAAFontSettings=lcd
-Dswing.aatext=true
@aras-p
aras-p / preprocessor_fun.h
Last active May 18, 2024 08:55
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@johnantoni
johnantoni / mysql.txt
Created August 7, 2012 18:57
mysql + vagrant + remote access
username: vagrant
password: vagrant
sudo apt-get update
sudo apt-get install build-essential zlib1g-dev git-core sqlite3 libsqlite3-dev
sudo aptitude install mysql-server mysql-client
sudo nano /etc/mysql/my.cnf
@jordansissel
jordansissel / Procfile
Created April 5, 2012 19:29
Jenkins on Heroku
# Only listen on http; disable ajp and https
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1
@gsdevme
gsdevme / ipv6-mysql.php
Created April 2, 2012 04:52
Shit for handling IPv6 & mysql storage
<?php
/**
* Shit for handling IPv6 & mysql storage, @gsphpdev
* Bloody headache... remember this Gavin!
*/
/**
* Only PHP 5.4+ has this function so need to add one if not
@apinstein
apinstein / gist:1083936
Created July 15, 2011 02:43
postgres table-as-queue lock experiment
#!/bin/bash
# RESULTS, feel free to repro yourself
#
# noLock FAIL
# accessShare FAIL
# rowShare FAIL
# rowExclusive FAIL
# shareUpdateExclusive SUCCESS
# share FAIL+DEADLOCKS
# shareRowExclusive SUCCESS