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 | |
/** | |
* Get post id from meta key and value | |
* @param string $key | |
* @param mixed $value | |
* @return int|bool | |
* @author David Mårtensson <[email protected]> | |
*/ | |
function get_post_id_by_meta($key, $value) { | |
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
<?php | |
/** | |
* @param WP_Query|null $wp_query | |
* @param bool $echo | |
* | |
* @return string | |
* Accepts a WP_Query instance to build pagination (for custom wp_query()), | |
* or nothing to use the current global $wp_query (eg: taxonomy term page) | |
* - Tested on WP 4.9.5 |
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 | |
namespace App\Http\Controllers; | |
use App\Result; | |
use Illuminate\Http\Request; | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
class ExportController extends Controller | |
{ |
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
#################################### | |
Quick start: | |
#################################### | |
mysql -u root -p -e "create database bookstore"; | |
mysql -u root -p bookstore < bookstore.sql | |
DROP TABLE IF EXISTS `books`; | |
CREATE TABLE `books` ( | |
`id` int(10) unsigned NOT NULL AUTO_INCREMENT, |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Document</title> | |
</head> | |
<body> | |
<script src="jquery-3.2.1.min.js"></script> | |
<script> | |
jQuery.ajax({ |
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
use App\MyModel; | |
... | |
use Symfony\Component\HttpFoundation\StreamedResponse; | |
... | |
public function Export() { | |
$results = MyModel::all()->toArray(); | |
$headers = $this->getFileResponseHeaders('export.csv'); | |
return $this->streamFile(function () use ($results) { |
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
# 0. Install brew if you don't have it. | |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# 1. Install font fira code | |
brew tap homebrew/cask-fonts | |
brew cask install font-fira-code | |
# # # # # # Sublime Text # # # # # # | |
# 2. Menu Sublime Text > Preferences > Settings (shortcut: ⌘,), add following code: |
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
# Download and install XAMPP | |
https://www.apachefriends.org/download.html | |
# Create a database, you may need to cd to mysql bin folder first to execute mysql command | |
cd /path/to/mysql/bin | |
mysql -u root -p | |
enter | |
create database db_name_you_want; | |
exit |
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
1 git clone https://github.com/electron/electron-quick-start nodeapp | |
2 cd nodeapp | |
3 npm install | |
4 npm install jquery bootstrap popper.js request electron-connect | |
5 npm install gulp-cli -g | |
6 npm install gulp -D | |
7 create file gulpfile.js | |
'use strict'; | |
var gulp = require('gulp'); |
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
const delay = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
async function something() { | |
console.log("this might take some time...."); | |
await delay(5000); | |
console.log("done!") | |
} | |
something(); |