Skip to content

Instantly share code, notes, and snippets.

View jgermade's full-sized avatar
🎨
Working from home

Jesús Germade jgermade

🎨
Working from home
View GitHub Profile
@stefansundin
stefansundin / install-pre-commit.sh
Last active January 21, 2025 15:09
Git pre-commit check to stop accidental commits to master/main/develop branches.
#!/bin/bash
# This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch.
# There are six variants that I have built:
# - pre-commit: stops commits to master/main/develop branches.
# - pre-commit-2: also includes a core.whitespace check.
# - pre-commit-3: the core.whitespace check and an EOF-newline-check.
# - pre-commit-4: only the core.whitespace check.
# - pre-commit-5: elixir formatting check.
# - pre-commit-6: prettier formatting check.
# Set the desired version like this before proceeding:
@tanmaypatel
tanmaypatel / isDocumentLoaded.js
Created February 16, 2014 07:39
How to check if an HTML page is already loaded. Even after "load" event has dispatched!
/* This has been supported in IE and webkit for a long time. It was added to Firefox in 3.6. Here's the spec (http://www.w3.org/TR/html5/dom.html#dom-document-readystate). "loaded" is for older Safari browsers.*/
if (document.readyState == "complete" || document.readyState == "loaded")
{
// document is already ready to go
}
/* If you want to know when the page has been parsed, but all subresources have not yet been loaded, you can add the "interactive" value: */
if (document.readyState == "complete"
|| document.readyState == "loaded"
|| document.readyState == "interactive") {
@larryli
larryli / cgi.go
Last active March 5, 2024 17:14
golang net/http/cgi example
// go build -ldflags "-s -w" -o index.cgi cgi.go
package main
import (
"fmt"
"net/http"
"net/http/cgi"
)
@Stanback
Stanback / nginx.conf
Last active March 30, 2025 03:57 — forked from michiel/cors-nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@cedricziel
cedricziel / dnsmasq.conf
Created October 24, 2013 12:23
Wildcard vhosts with nginx on a dev machine 1. Place wildcard.conf in /etc/nginx/sites-enabled or symlink it here 2. Place typo3 in /etc/nginx 3. Adjust the paths. I prefer to hold anything inside ~/public_html (needs adjustments. wire up www-data [or your systems flavor of that) and your current user group. Also let your php-fpm pool use your u…
address=/t3cmsdev/127.0.0.1
address=/l/127.0.0.1
address=/silex/127.0.0.1
address=/symfony2/127.0.0.1
address=/dev/127.0.0.1
@bonesoul
bonesoul / backup-db-to-git.sh
Last active March 24, 2022 15:56
MySQL Database to Git Backup Script
#!/bin/sh
cd /var/www/YOURSITE.ORG
date=`date +"%b-%d-%y-%H-%M-%S"`
mysqldump -h SERVER_IP -u root -pPASSWORD --skip-extended-insert --skip-dump-date --databases DBNAME > db-backups/YOURSITE.ORG.sql
git add -A
git commit -m "Site backups for $date"
git push
git gc
@aaronpk
aaronpk / Makefile
Last active December 20, 2015 10:39
me:
ifeq ($(USER), root)
@echo "\c"
else
@echo "make \c"
endif
a:
ifeq ($(USER), root)
@echo "\c"
@jimothyGator
jimothyGator / README.md
Last active December 20, 2024 09:08
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@desandro
desandro / bower-logo.md
Last active December 30, 2021 23:11
Bower logo

In addition to awesome docs #228, Bower deserves a proper logo. See below for sketches. I'm curious if you think any of these are worth me putting more effort into.


Take a look at Yeoman right now.

Screen Shot 2013-02-19 at 4 43 10 PM

The other two entities have awesome logos. Bower's got to represent.

@jessedearing
jessedearing / gist:2351836
Created April 10, 2012 14:44 — forked from twoism-dev/gist:1183437
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key