Skip to content

Instantly share code, notes, and snippets.

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

Franco Salcedo francosalcedo

🏠
Working from home
  • Lima, Perú
View GitHub Profile
@scottjehl
scottjehl / getViewportSize.js
Created March 16, 2012 19:25
Reliably get viewport dimensions in JS
/*!
An experiment in getting accurate visible viewport dimensions across devices
(c) 2012 Scott Jehl.
MIT/GPLv2 Licence
*/
function viewportSize(){
var test = document.createElement( "div" );
test.style.cssText = "position: fixed;top: 0;left: 0;bottom: 0;right: 0;";
@gotomypc
gotomypc / redis_mysql_dump.js
Created November 10, 2012 14:51 — forked from m0llysour/redis_mysql_dump.js
Redis to MySQL dump
// modules
var redis = require('redis');
var Step = require('step');
// config file
var config = require('config');
// mysql client connect
var mysql = require('mysql');
var connection = mysql.createConnection({
@Zodiac1978
Zodiac1978 / .htaccess
Last active June 23, 2024 17:39
Safer WordPress with these .htaccess additions
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
<IfModule mod_autoindex.c>
@RopoMen
RopoMen / facebook_page_plugin.html
Created July 21, 2015 18:15
Simple way to resize Facebook's new Page plugin
<!--
Width 10000px is quite wide, but it has room for new "max", also because Facebook's "adaptation" means only shrinking
the Page plugin to fit smaller container. To use Page plugin with larger container than 500px (current max.) you could try
to add example Bootstrap class '.center-block' which would center the Page plugin inside larger container.
-->
<div class="row">
<div class="column-xs-6">
<div class="fb-page center-block" data-width="10000" data-adapt-container-width="true" data-href="https://www.facebook.com/facebook"></div>
</div>
</div>
@dangtrinhnt
dangtrinhnt / get_chrome_cached_file.js
Created September 10, 2016 08:42
Get Chrome's cached file
(function() {
var preTags = document.getElementsByTagName('pre');
var preWithHeaderInfo = preTags[0];
var preWithContent = preTags[2];
var lines = preWithContent.textContent.split('\n');
// get data about the formatting (changes between different versions of chrome)
var rgx = /^(0{8}:\s+)([0-9a-f]{2}\s+)[0-9a-f]{2}/m;
var match = rgx.exec(lines[0]);
@heiswayi
heiswayi / SimpleAuth.php
Created December 20, 2017 14:28
Simple PHP script to protect any PHP page using session
<?php
/*
* Filename: SimpleAuth.php
* Version: 1.0
* Author: Heiswayi Nrird
* Dscription: Simple PHP script to protect any PHP page using session
* Website: https://heiswayi.nrird.com
*
* HOW TO USE
* ==========
@kevinhooke
kevinhooke / gist:275756d1e6c69f8e47af45c31184ab84
Created February 20, 2021 00:03
Local DynamoDB in Docker with DynamoDB Workbench (tables not visible)
If you start the local DynamoDB Docker instance without the -shareDb option, tables are not visible either to
the 'aws dynamodb' cli or DynamodDB Workbench:
docker run -d -p 8000:8000 amazon/dynamodb-local
If you start with the -shareDb option needed to see the tables, the container ends immediately.
Per answer on this question https://stackoverflow.com/questions/63835658/can-not-find-table-using-nosql-workbench-for-dynamodb-when-connecting-to-dynamod
start with -shareDb and all other default options:
docker run -d -p 8000:8000 amazon/dynamodb-local -jar DynamoDBLocal.jar -sharedDb -dbPath .
@francosalcedo
francosalcedo / mysql-sail.md
Created September 1, 2023 17:26 — forked from jjsquady/mysql-sail.md
Laravel Sail - GRANT ALL PRIVILEGES to user

Run this command in sail project folder:

docker-compose exec mysql bash

execute the mysql -u root -p command

provide the default password password

then executes