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 | |
// tax_query is not usable in switched blog context: | |
// https://core.trac.wordpress.org/ticket/32526 | |
switch_to_blog(123); | |
$taxonomy = "category"; | |
$operator = "in"; | |
$terms = ["news", "blog"]; | |
$tax_query_where = function ($where, $query) use ($terms, $operator, $taxonomy) { | |
global $wpdb; |
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 | |
$groups = acf_get_local_field_groups(); | |
$json = []; | |
foreach ($groups as $group) { | |
$fields = acf_get_fields($group['key']); | |
unset($group['ID']); | |
$group['fields'] = $fields; | |
$json[] = $group; | |
} |
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
[package] | |
name = "yourpackage" | |
version = "0.1.0" | |
authors = ["John Doe"] | |
edition = "2018" | |
[[bin]] | |
name = "example" | |
path = "stream-a-file-using-rust-hyper.rs" |
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
rem Run this file as admin on startup using Task Scheduler | |
imdisk -a -o awe -s 1024M -m Z: -p "/fs:ntfs /q /y" | |
mkdir "z:\chrome\" | |
mkdir "z:\chrome\Application Cache\" | |
mkdir "z:\chrome\blob_storage" | |
mkdir "z:\chrome\Cache" | |
mkdir "z:\chrome\GPUCache" | |
mkdir "z:\chrome\Session Storage" |
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
newtype Maybe' a = Maybe' {getMaybe' :: Maybe a} | |
deriving Show | |
-- $setup | |
-- >>> :set -XScopedTypeVariables | |
-- >>> :set -XFlexibleContexts | |
-- >>> import Test.QuickCheck | |
-- $ | |
-- | Maybe |
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
// Android Q specific way to listen for home wifi | |
fun jobListenWifiHome(ctx: Context) { | |
val jobScheduler = getSystemService(ctx, JobScheduler::class.java) ?: return | |
if (jobScheduler.getPendingJob(6) != null) { | |
return | |
} | |
var netspec = WifiNetworkSpecifier.Builder() // This requires Android Q | |
.setSsid("your home wifi SSID") | |
.build() | |
var req = NetworkRequest.Builder() |
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 | |
$w = 20; | |
$h = 3; | |
$spacing = 7; | |
$padding = 2; | |
?> | |
<svg | |
xmlns="http://www.w3.org/2000/svg" | |
viewBox="<?php echo -$padding; ?> <?php echo -$padding; ?> <?php echo $w * $spacing + $padding * 2; ?> <?php echo $h * $spacing + $padding * 2; ?>" | |
version="1.1"> |
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 sqlite3 from "sqlite3"; | |
let db: any; | |
beforeEach(done => { | |
db = new sqlite3.Database(":memory:", () => { | |
db.run("CREATE TABLE foo (a INT, b INT)", done); | |
}); | |
}); |
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 sqlite3 from "sqlite3"; | |
let db: any; | |
beforeEach(done => { | |
db = new sqlite3.Database(":memory:", () => { | |
db.run("CREATE TABLE foo (num INT)", done); | |
}); | |
}); |
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 { createConnection, getConnection, Entity, getRepository } from "typeorm"; | |
import { PrimaryGeneratedColumn, Column } from "typeorm"; | |
@Entity() | |
export class MyEntity { | |
@PrimaryGeneratedColumn() | |
id?: number; | |
@Column() | |
name?: string; |