The elvis operator (?:) is actually a name used for shorthand ternary (which was introduced in PHP 5.3). It has the following syntax:
expr1 ?: expr2;
This is equivalent to:
expr1 ? expr1 : expr2;
<?php | |
/** | |
* You may also call the additional() method on your API resource instance if you need to define meta data at the controller level. | |
*/ | |
public function show(User $user) | |
{ | |
return UserResource::make($user)->additional([ | |
'meta' => [ | |
'key' => 'value', |
<?php | |
class DateTimeResource extends JsonRsource | |
{ | |
public function toArray($request) | |
{ | |
return [ | |
'datetime' => $this->toISOString(), | |
'human_diff' => $this->diffForHumans(), | |
'human' => $this->toDayDateTimeString(), |
Path Mac OS X | |
~/Library/Application Support/com.fournova.Tower2/ | |
Database file | |
Tower.sqlite3 | |
SQLite Application (Mac OS X) | |
https://sqlitebrowser.org/ | |
Query to update |
const Button = ({ Component = 'button', ...props }) => <Component {...props} /> | |
<Button>A Button</Button> // Renders a button element | |
<Button Component="a">A Link</Button> // Renders an anchor element |
import React, { useState, useEffect, useRef } from "react"; | |
export default function App() { | |
const [name, setName] = useState(""); | |
const loaded = useRef(false); | |
useEffect(() => { | |
if (!loaded.current) { | |
console.log("Load on Init!"); | |
setName("Bob"); |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] | |
RewriteRule ^(.*)$ https://%1/$1 [R=301,L] | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP:X-Forwarded-Proto} =http | |
#for proxy/load balancer 👆 | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
const CombinedProviders = combineProviders( | |
SentryProvider, | |
NavbarProvider, | |
SidebarProvider, | |
FooterProvider, | |
BlogsProvider, | |
) | |
function App() { | |
return ( |
const stringifySafe = () => { | |
const stack = []; | |
const keys = []; | |
const cycleReplacer = (key, value) => { | |
if (stack[0] === value) { | |
return '[Circular ~]'; | |
} | |
return `[Circular ~.${keys.slice(0, stack.indexOf(value)).join('.')}]`; | |
}; |
<?php | |
// have to add that opening tag to get syntax highlighting... ¯\_(ツ)_/¯ | |
/** | |
* Prevent update notification for plugin | |
* http://www.thecreativedev.com/disable-updates-for-specific-plugin-in-wordpress/ | |
* Place in theme functions.php or at bottom of wp-config.php | |
*/ | |
function disable_plugin_updates( $value ) { |