Skip to content

Instantly share code, notes, and snippets.

View luisalonsobr's full-sized avatar
🎯
Focusing

Luis Alonso luisalonsobr

🎯
Focusing
View GitHub Profile
@alaminfirdows
alaminfirdows / Encryption.js
Created April 5, 2020 18:48 — forked from ve3/Encryption.js
Encrypt and decrypt between programming languages (PHP & JavaScript).
/**
* Encryption class for encrypt/decrypt that works between programming languages.
*
* @author Vee Winch.
* @link https://stackoverflow.com/questions/41222162/encrypt-in-php-openssl-and-decrypt-in-javascript-cryptojs Reference.
* @link https://github.com/brix/crypto-js/releases crypto-js.js can be download from here.
*/
class Encryption {
@micc83
micc83 / mysqldump.php
Created June 5, 2017 13:17
Simple PHP script to dump a MySql database
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$database = 'db';
$user = 'user';
$pass = 'pass';
$host = 'localhost';
if (preg_match('~MSIE|Internet Explorer~i', $_SERVER['HTTP_USER_AGENT']) || (strpos($_SERVER['HTTP_USER_AGENT'], 'Trident/7.0; rv:11.0') !== false)) {
//is IE 11 or below
}
@wojteklu
wojteklu / clean_code.md
Last active May 18, 2024 11:12
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@kuldipem
kuldipem / android-os-and-browser-detect
Created August 20, 2014 07:09
Javascript snippet to detect android mobile,browser (Stock browser) and get OS version
var android = {
uAString: function() {
return navigator.userAgent;
},
// Android Mobile
isAndroidMobile: function() {
return android.uAString().indexOf('Android') > -1 && android.uAString().indexOf('Mozilla/5.0') > -1 && android.uAString().indexOf('AppleWebKit') > -1;
},
// Android Browser (not Chrome)
regExAppleWebKit: function() {
@thiagosilr
thiagosilr / paisesPortuguesIngles.sql
Created November 9, 2012 13:30
Tabela MYSQL com o nome de todos os países em Português / Inglês
--
-- Estrutura da tabela `pais`
--
CREATE TABLE IF NOT EXISTS `pais` (
`paisId` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
`paisNome` varchar(50) NOT NULL,
`paisName` varchar(50) NOT NULL,
PRIMARY KEY (`paisId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=253 ;