Skip to content

Instantly share code, notes, and snippets.

View kevinruscoe's full-sized avatar
💻
Working

Kevin Ruscoe kevinruscoe

💻
Working
View GitHub Profile
<?php
// Assuming the field name is 'url'.
// Don't forget to URL encode
$url = sprintf("http://www.facebook.com/share/dialog/app_id=xxxxxx%s&redirecht_uri=myurl.com", get_field('url'));
// Or use http_build_query
$url = sprintf('http://www.facebook.com/share/dialog/%s', http_build_query([
'app_id' => 'xxxxxx',
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/MyTheme/Theme',
__DIR__
);
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>My Theme</title>
<parent>Magento/luma</parent>
</theme>
.navbar-hoverable {
.dropdown {
&:hover {
.dropdown-menu {
display: block;
margin-top: 0;
}
}
}
}
@supports(display:grid) {
#recipes {
display: grid;
grid-template-columns: repeat(4, 1fr);
padding: 0;
grid-gap: 30px;
margin: 0 30px;
width: auto;
}
protected function updateQuantityRelative($item, $key, $value){
if (preg_match('/\-/', $value) == 1) {
$value = floatval(str_replace('-', '', $value));
if (($item[$key] - $value) > 0) {
$item[$key] -= $value;
}
} elseif (preg_match('/\+/', $value) == 1) {
$item[$key] += floatval(str_replace('+', '', $value));
} else {
# Include a redirect map, incase 301s are needed
# include /etc/nginx/conf.d/redirect-map.conf;
server {
listen 80;
server_name @@DOMAIN@@ www.@@DOMAIN@@;
root /var/www/vhosts/@@DOMAIN@@/public;
# Cache general assets for as long as possible
location ~* ^.+\.(ogg|ogv|eot|otf|woff|mp4|ttf|rss|atom|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|rtf)$ {
$cols: 12;
$gap: .5rem;
.css-grid {
display: grid;
grid-template-columns: repeat($cols, auto);
grid-gap: $gap $gap;
@for $col from 1 to ($cols+1) {
<?php
class API {
private $token;
private $tokenExpiry;
public function __construct()
{
$this->deserializeToken();