This file contains 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 | |
// Author: Jari Pennanen | |
// License: Public Domain | |
// 2014-04-16 | |
/** | |
* Display taxonomy selection in admin as select box | |
* | |
* @param WP_Post $post | |
* @param array $box |
This file contains 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 | |
/** | |
* Show taxonomy selection in WordPress admin as single <select> box or checkboxes | |
* | |
* @author Jari Pennanen / https://github.com/ciantic | |
* @license Public Domain | |
**/ | |
// Usage example: | |
register_taxonomy("my_taxonomy", array("post"), array( |
This file contains 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
// total in seconds | |
function formatTime(total: number): string { | |
// If the number is float ceiling gives best result | |
var total = Math.ceil(total), | |
mins = Math.floor(total / 60), | |
secs = Math.floor(total - mins * 60), | |
m = ("000" + mins).slice(-2), | |
s = ("000" + secs).slice(-2); | |
return m + ":" + s; |
This file contains 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
import customelement = require('./customelement'); | |
export class MyElement extends customelement.CustomHTMLElement { | |
public myTest() { | |
// "this" is fully qualified, includes all methods e.g. addEventListener, dispatchEvent | |
console.log("this", this); | |
console.dir(this); | |
} | |
} |
This file contains 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
/** | |
* Parse ISO datetime | |
* | |
* 2014-10-18 15:30:30 | |
* 2014-10-18T15:30:30 | |
* 2014-10-18 | |
*/ | |
function parseIsoDatetime(dtstr) { | |
var dt = dtstr.split(/[: T-]/).map(parseFloat); |
This file contains 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
import javax.inject.{Singleton, Inject} | |
import com.google.inject.AbstractModule | |
import play.api.db.{DBApi} | |
import play.api.{Logger, Configuration} | |
import org.jooq.util.GenerationTool | |
import org.jooq.util.jaxb.{Target, Database, Generator} | |
import play.api.db.evolutions.EvolutionsModule | |
import play.api.Play.current |
This file contains 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 | |
/** | |
* (WordPress) Insert or get term id | |
* | |
* @return int Term ID (0 no term was inserted or found) | |
*/ | |
function __wp_insert_or_get_term_id($name, $taxonomy, $parent = 0) { | |
if (!($term = get_term_by("name", $name, $taxonomy))) { | |
$insert = wp_insert_term($name, $taxonomy, array( |
This file contains 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 | |
function just_export_damn_taxonomies($taxs = array(), $include_cats = false, $include_tags = false) { | |
$WXR_VERSION = '1.2'; | |
// functions from 'wp-admin/includes/export.php' | |
function wxr_cdata($str) { | |
if (seems_utf8 ( $str ) == false) | |
$str = utf8_encode ( $str ); | |
This file contains 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
import * as http from 'http'; | |
import * as https from 'https'; | |
import * as fs from 'fs'; | |
import * as path from 'path'; | |
import * as os from 'os'; | |
import { spawn, ChildProcess } from 'child_process'; | |
import * as when from 'when'; // when package | |
import * as which from 'which'; // which package |
This file contains 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
#!/bin/bash | |
wpdir=public_html | |
dbfile=db-joawsefj3j14.sql | |
wpconfig=$wpdir/wp-config.php | |
if [ ! -f "$wpconfig" ]; then | |
echo "$wpconfig not found." | |
exit | |
fi |