Skip to content

Instantly share code, notes, and snippets.

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

Mukesh Patel patelnwd

🏠
Working from home
View GitHub Profile
@embiem
embiem / generate_local_ssl.bat
Created September 14, 2017 19:50
modified OpenSSL config & batch file to generate self-signed certificate for Twitch extension development
openssl req -newkey rsa:4096 -days 1001 -nodes -x509 -subj "/C=US/ST=California/L=San Francisco/O=Twitch/OU=web/CN=localhost" -extensions SAN -config ".\openssl.cnf" -keyout "testing.key" -out "testing.crt"
Artisan
// Displays help for a given command
php artisan --help OR -h
// Do not output any message
php artisan --quiet OR -q
// Display this application version
php artisan --version OR -V
// Do not ask any interactive question
php artisan --no-interaction OR -n
// Force ANSI output
@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';
1. Make Home Directory for SShH keys.
c://users/UserName/.SSH (for Windows 7)
2. Generate SSH key by command:
ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key, using the provided email as a label
Generating public/private rsa key pair.
It's created a pair of keys - private and public in home dir .SSH
C:\Users\SuvorovAG\.ssh\id_rsa
@ewwink
ewwink / http_response_code.php
Created February 14, 2016 02:30
PHP Class for HTTP Response Status Codes
<?php
/**
* StatusCodes provides named constants for
* HTTP protocol status codes. Written for the
* Recess Framework (http://www.recessframework.com/)
*
* @author Kris Jordan
* @license MIT
* @package recess.http
*
@fabiomaggio
fabiomaggio / ckeditor-responsive-images.js
Created January 22, 2016 19:10
Make inserted images in CKEditor automatically responsive
// If you want inserted images in a CKEditor to be responsive
// you can use the following code. It creates a htmlfilter for the
// image tag that replaces inline "width" and "style" definitions with
// their corresponding attributes and add's (in this example) the
// Bootstrap "img-responsive" class.
CKEDITOR.on('instanceReady', function (ev) {
ev.editor.dataProcessor.htmlFilter.addRules( {
elements : {
img: function( el ) {
// Add bootstrap "img-responsive" class to each inserted image
@djaiss
djaiss / timezone.php
Last active November 4, 2024 13:00
Timezone in PHP
<?php
return array (
'(UTC-11:00) Midway Island' => 'Pacific/Midway',
'(UTC-11:00) Samoa' => 'Pacific/Samoa',
'(UTC-10:00) Hawaii' => 'Pacific/Honolulu',
'(UTC-09:00) Alaska' => 'US/Alaska',
'(UTC-08:00) Pacific Time (US &amp; Canada)' => 'America/Los_Angeles',
'(UTC-08:00) Tijuana' => 'America/Tijuana',
'(UTC-07:00) Arizona' => 'US/Arizona',
@carlaizumibamford
carlaizumibamford / How to change the default charset to UTF-8 on XAMMP (MySQL)
Created November 10, 2014 21:06
How to change the default charset to UTF-8 on XAMMP (MySQL)
1. Open "my.ini" in "C:\xampp\mysql\bin\" directory.
2. Edit the following lines.
# Add the following code before [client].
default-character-set=utf8
# Add the following code before [mysqld].
character-set-server=utf8
skip-character-set-client-handshake
@Daniel-Hug
Daniel-Hug / arr-stat.js
Last active December 11, 2023 14:46
JavaScript statistical functions for arrays: max, min, range, midrange, sum, mean / average, median, modes, variance, standard deviation, mean absolute deviation, z scores
var arr = {
max: function(array) {
return Math.max.apply(null, array);
},
min: function(array) {
return Math.min.apply(null, array);
},
range: function(array) {
@menzerath
menzerath / backup.php
Last active February 18, 2024 19:33
PHP: Recursively Backup Files & Folders to ZIP-File
<?php
/*
* PHP: Recursively Backup Files & Folders to ZIP-File
* MIT-License - 2012-2018 Marvin Menzerath
*/
// Make sure the script can handle large folders/files
ini_set('max_execution_time', 600);
ini_set('memory_limit', '1024M');