# Install http-server module globally
npm install http-server -g
# Navigate to any directory you want the server to run in
cd /path/to/dir/with/files
# Launch HTTP server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# git | |
alias g="git" | |
alias gs="git status" | |
alias ga="git add ." | |
alias gc="git commit -m" | |
alias gn="git init && git add . && git commit -m \"init\"" | |
# laravel | |
alias pa="php artisan" | |
alias l="php artisan serve" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"", | |
"Asia/Pacific Region", | |
"Europe", | |
"Andorra", | |
"United Arab Emirates", | |
"Afghanistan", | |
"Antigua and Barbuda", | |
"Anguilla", | |
"Albania", | |
"Armenia", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Delete Attachments from Post ID 25 | |
$attachments = get_posts( | |
array( | |
'post_type' => 'attachment', | |
'posts_per_page' => -1, | |
'post_status' => 'any', | |
'post_parent' => 25, | |
) | |
); | |
foreach ( $attachments as $attachment ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_post_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//absolute path to wp-load.php, or relative to this script | |
//e.g., ../wp-core/wp-load.php | |
include( 'trunk/wp-load.php' ); | |
//grab the WPDB database object, using WP's database | |
//more info: http://codex.wordpress.org/Class_Reference/wpdb | |
global $wpdb; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create tables -- | |
DROP TABLE IF EXISTS wp_posts; | |
CREATE TABLE wp_posts ( | |
ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
name VARCHAR(255) NOT NULL, | |
post_type VARCHAR(255) NOT NULL DEFAULT 'hso_product', | |
post_status VARCHAR(255) NOT NULL DEFAULT 'publish', | |
menu_order INT NOT NULL DEFAULT 0 | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function iframeURLChange(iframe, callback) { | |
var lastDispatched = null; | |
var dispatchChange = function () { | |
var newHref = iframe.contentWindow.location.href; | |
if (newHref !== lastDispatched) { | |
callback(newHref); | |
lastDispatched = newHref; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$string = "The text you want to filter goes here. http://google.com, https://www.youtube.com/watch?v=K_m7NEDMrV0,https://instagram.com/hellow/"; | |
preg_match_all('#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $string, $match); | |
echo "<pre>"; | |
print_r($match[0]); | |
echo "</pre>"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Create a posts array in your data: | |
... | |
data() { | |
return { | |
posts: [] | |
} | |
}, | |
.... | |
Then create a method that fetches the records and assigns the result to the posts array: |
NewerOlder