Skip to content

Instantly share code, notes, and snippets.

View kellyfire611's full-sized avatar
🙃
On the new way, fly to NenTang zone !!!

Dương Nguyễn Phú Cường kellyfire611

🙃
On the new way, fly to NenTang zone !!!
View GitHub Profile
@morganestes
morganestes / .readme.md
Last active November 9, 2022 18:07
Create multiple sites with wp-cli in WordPress multisite for testing.

These commands will install multiple dummy sites in a WordPress Multisite environment.

I wrote this to easily create an environment to work on https://core.trac.wordpress.org/ticket/15317.

Usage

Shell

In the terminal, inside your WordPress directory: simply copy, paste, and run the one-line command.

You can also add it to a location available in your $PATH and invoke the script from the shell.

@ghalusa
ghalusa / youtube_id_regex.php
Created June 20, 2015 23:14
Extract the YouTube Video ID from a URL in PHP
<?php
// Here is a sample of the URLs this regex matches: (there can be more content after the given URL that will be ignored)
// http://youtu.be/dQw4w9WgXcQ
// http://www.youtube.com/embed/dQw4w9WgXcQ
// http://www.youtube.com/watch?v=dQw4w9WgXcQ
// http://www.youtube.com/?v=dQw4w9WgXcQ
// http://www.youtube.com/v/dQw4w9WgXcQ
// http://www.youtube.com/e/dQw4w9WgXcQ
// http://www.youtube.com/user/username#p/u/11/dQw4w9WgXcQ
@benjasHu
benjasHu / jquery-plugin.js
Last active March 13, 2021 07:36
ES6 Module jQuery Plugin Definition
import pluginify from 'pluginify';
class Plugin {
constructor() {
/* ... */
}
}
/*
Convert plugin class into a jQuery plugin
@jatubio
jatubio / web.config
Created April 29, 2015 03:49
IIS web.config file for Laravel 5
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<!-- Quitar los slash '/' del final de la ruta -->
<rule name="RewriteRequestsToPublic">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
</conditions>
@dpapathanasiou
dpapathanasiou / SchemaSpy-HOWTO.md
Last active February 17, 2024 19:45
How to use SchemaSpy to generate the db schema diagram for a PostgreSQL database

SchemaSpy is a neat tool to produce visual diagrams for most relational databases.

Here's how to use it to generate schema relationship diagrams for PostgreSQL databases:

  1. Download the jar file from here (the current version is v6.1.0)

  2. Get the PostgreSQL JDBC driver (unless your installed version of java is really old, use the latest JDBC4 jar file)

  3. Run the command against an existing database. For most databases, the schema (-s option) we are interested in is the public one:

@Toddses
Toddses / iis-web.config
Last active May 25, 2024 10:16
Example web.config for WordPress on IIS
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
@oNguyenThanhTung
oNguyenThanhTung / chef.md
Last active August 25, 2024 16:44
Tìm hiểu về Chef

Tìm hiểu về Chef

##Giới thiệu

Trong các giai đoạn phát triển các ứng dụng, dịch vụ dùng server thì việc xây dựng deployment là không thể thiếu được. Giai đoạn này đòi hỏi người thiết định phải có kinh nghiệm, kiến thức về server, cấu hình hệ thống, performance. Đặc biệt là đối với các hệ thống có số node (server) từ 2 hoặc nhiều hơn thì việc thống nhất giữa 2 server là rất quan trọng. Người thực hiện bắt buộc phải ghi nhớ các libraries, tools của từng loại server (DB server thế nào, Cache server, Web server như thế nào). Ngoài ra các thiết lập, cấu hình đã dùng trong quá trình development và production cũng phải đảm bảo tính thống nhất. Do đó quá trình deployment thường gặp phải các khó khăn

@tortuetorche
tortuetorche / INSTALL4Windows.md
Last active April 12, 2020 23:06
Redis for Windows as a Memcache successor for PHP applications and as a queue driver for Laravel

Install Redis as a service on Windows

Installation instructions

  1. Download and extract the last Redis version (2.8.4)
  2. Copy all extracted binaries to c:\redis\bin
  3. Create another folder at c:\redis\inst1
  4. Download and extract the RedisWatcher binaries from the 2.4 branch
  5. Run InstallWatcher.msi with administrator rights. This should create a Windows service called Redis watcher.
@simshaun
simshaun / gist:7592631
Created November 22, 2013 00:37
TinyMCE 4.0.11 - Automatically remove width and height attributes from img elements inserted via the img plugin
setup: function (editor) {
editor.on('init', function(args) {
editor = args.target;
editor.on('NodeChange', function(e) {
if (e && e.element.nodeName.toLowerCase() == 'img') {
tinyMCE.DOM.setAttribs(e.element, {'width': null, 'height': null});
}
});
}
@velosipedist
velosipedist / postgresql-list-foreign-keys.sql
Created October 31, 2013 13:52
List all foreign keys in PostgreSQL database, analog of MySQL SHOW CREATE TABLE mytable;
--- Source: http://solaimurugan.blogspot.ru/2010/10/list-out-all-forien-key-constraints.html
SELECT
tc.constraint_name,
tc.constraint_type,
tc.table_name,
kcu.column_name,
tc.is_deferrable,
tc.initially_deferred,
rc.match_option AS match_type,