Skip to content

Instantly share code, notes, and snippets.

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

Jonas Rosado jonaswebdev

🏠
Working from home
View GitHub Profile
@jonashansen229
jonashansen229 / class.database.php
Last active June 20, 2023 08:41
PHP OOP Database class using MySQLI and Singleton pattern. Only one instance of the class will be made, this requires less memory.
<?php
/*
* Mysql database class - only one connection alowed
*/
class Database {
private $_connection;
private static $_instance; //The single instance
private $_host = "HOSTt";
private $_username = "USERNAME";
private $_password = "PASSWORd";
@balupton
balupton / README.md
Last active June 7, 2021 16:00
Node.js Best Practice Exception Handling
{
"require": {
"slim/slim": "2.*",
"illuminate/database": "*",
"dhorrigan/capsule": "*"
}
}
@larrybotha
larrybotha / readme.markdown
Last active October 27, 2021 04:28
Postfix Using Gmail SMTP in Mac OSX Mavericks
@PaulKinlan
PaulKinlan / criticalcss-bookmarklet-devtool-snippet.js
Last active April 2, 2024 02:45
CriticalCSS Bookmarklet and Devtool Snippet.js
(function() {
var CSSCriticalPath = function(w, d, opts) {
var opt = opts || {};
var css = {};
var pushCSS = function(r) {
if(!!css[r.selectorText] === false) css[r.selectorText] = {};
var styles = r.style.cssText.split(/;(?![A-Za-z0-9])/);
for(var i = 0; i < styles.length; i++) {
if(!!styles[i] === false) continue;
var pair = styles[i].split(": ");
@mattheu
mattheu / gist:7127778
Created October 23, 2013 22:18
## Fix login loop. * When WordPress is installed in a subdirectory, wp-admin/ links don't work correctly. We fix this with an nginx rewrite. * But... it appends reauth=1 to the url which forces a reauthentication when submitted... and you have to log in again!
/**
* Fix login loop.
*
* When WordPress is installed in a subdirectory, wp-admin/ links don't work correctly. We fix this with an nginx rewrite.
* But... it appends reauth=1 to the url which forces a reauthentication when submitted... and you have to log in again!
*/
add_filter( 'login_url', function( $url ) {
if ( '/wp-admin/' === add_query_arg( array() ) ) {
// Avoid `console` errors in browsers that lack a console.
(function() {
var method;
var noop = function () {};
var methods = [
'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
'timeStamp', 'trace', 'warn'
];
@denji
denji / nginx-tuning.md
Last active June 11, 2024 02:43
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@jloutsenhizer
jloutsenhizer / ChromecastAppList.json
Created February 7, 2014 00:22
List of Chromecast Receiver Apps as of 2/6/2014 7:00PM GMT-5:00
[
{
"use_channel":true,
"allow_empty_post_data":true,
"app_id":"edaded98-5119-4c8a-afc1-de722da03562",
"url":"http://chromecast.redbull.tv/receiver.php",
"dial_enabled":true
},
{
"use_channel":true,
@thomasfr
thomasfr / Git push deployment in 7 easy steps.md
Last active May 1, 2024 23:17
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook