Skip to content

Instantly share code, notes, and snippets.

View nguyenvanduocit's full-sized avatar
🌴
On vacation

Duoc Nguyen nguyenvanduocit

🌴
On vacation
View GitHub Profile
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<body>
<header class="header">
<div class="header__left">
<a class="header__logo"
check_admin_referer('update-post_' . $post_id);
$post_id = edit_post();
// Session cookie flag that the post was saved
if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
}
redirect_post($post_id); // Send user on their way while we keep working
function hcf_save( $post_id ) {
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return;
}
if ( $parent_id = wp_is_post_revision( $post_id ) ) {
$post_id = $parent_id;
}
$field_list = [
'hcf_author',
'hcf_published_date',
func (h *Handler) exec(requestBody utils.JsonIn) (*utils.JsonOut, error) {
cmd := exec.Command(h.Command)
cmd.Dir = h.WorkingDir
bRequestBody, err := json.Marshal(requestBody)
if err != nil {
return nil, err
}
cmd.Stdin = strings.NewReader(string(bRequestBody))
var out bytes.Buffer
cmd.Stdout = &out
func (h *Handler) Handle(w http.ResponseWriter, r *http.Request){
cmd := exec.Command(h.Command)
cmd.Dir = h.WorkingDir
cmd.Env = append(h.Env, fmt.Sprintf("FN_REQUEST_URL=%s", r.URL.RequestURI()))
requestContent, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
fmt.Fprint(w, err)
return
}
<template>
<div id="app" :class="[$style.app]">
<div :class="$style.header">
<nav :class="$style.nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</nav>
</div>
<main :class="$style.main">
<router-view/>
@nguyenvanduocit
nguyenvanduocit / pre-commit
Created July 30, 2018 10:27
Check for console.log before commit
#!/bin/sh
# 5:23 PM Friday, October 18, 2013 - Jim Priest
# origin script found here: http://python.dzone.com/articles/tips-using-git-pre-commit-hook
# Modified with console checks and to ignore commented file
echo "Executing post-commit checks..."
FILES_PATTERN='\.(js)(\..+)?$'
FORBIDDEN='console\.[clear|dir|log|info|warn|error]'
<?php
/**
* Template Name: Advanced Search
*/
get_header(); ?>
<?php
$min_price = $_GET['min_price'] ?? '';
$max_price = $_GET['max_price'] ?? '';
?>
<div class="wrap">
<?php
/*
Plugin Name: Hello Custom Field
Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates
Description: A brief description of the Plugin.
Version: 1.0
Author: duocnguyen
Author URI: http://URI_Of_The_Plugin_Author
License: A "Slug" license name e.g. GPL2
<ul class="post-meta">
<li><span class="post-meta-key">Price:</span> <?php echo esc_html(get_post_meta(get_the_id(), 'Price', true)) ?></li>
<li><span class="post-meta-key">Image:</span> <?php echo esc_html(get_post_meta(get_the_id(), 'Image', true)) ?></li>
<li><span class="post-meta-key">Type:</span> <?php echo esc_html(get_post_meta(get_the_id(), 'Type', true)) ?></li>
</ul>