Skip to content

Instantly share code, notes, and snippets.

@kayue
kayue / machine.js
Last active April 17, 2021 10:09
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
{
"meta": {
"type": "catalog"
},
"products": {
"page": 1,
"limit": 60,
"pages": 33,
"total": 1971,
"facets": {
@kayue
kayue / version.md
Last active December 2, 2015 06:55

Schema

CREATE TABLE `ext_log_entries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `action` varchar(8) COLLATE utf8_unicode_ci NOT NULL,
  `logged_at` datetime NOT NULL,
  `object_id` varchar(64) COLLATE utf8_unicode_ci DEFAULT NULL,
  `object_class` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
// Create view
Posts.views.add("latest", function (terms) {
return {
options: {sort: {lastCommentedAt: -1}}
};
});
// Route controller
Posts.controllers.latest = Posts.controllers.list.extend({
view: "latest"
Posts.views.add("latest", function (terms) {
return {
options: {sort: {lastCommentedAt: -1}}
};
});
Posts.controllers.latest = Posts.controllers.list.extend({
view: "latest"
});
# Install Nginx
brew install nginx
# Install Percona MySQL Server
# http://wizardmode.com/2012/06/apache-php-mysql-dev-on-os-x-lion-with-a-minimum-of-pain/
brew install percona-server
# Install PHP
# https://gist.github.com/mystix/3041577
brew tap josegonzalez/homebrew-php
<?php
namespace Hypebeast\Bundle\CoreBundle\Entity;
use Sylius\Component\Product\Model\OptionValue as BaseOptionValue;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity
* @ORM\Table(name="sylius_product_option_value")
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJCAQAAABKmM6bAAAAGUlEQVQI12NggIL//xnQAclC/zEAAxWNBwBQ9SHf5PiMxgAAAABJRU5ErkJggg==)
class WordpressPostVoter implements VoterInterface
{
const VIEW = 'view';
const EDIT = 'edit';
protected $wordpressRegistry;
public function __construct(ManagerRegistry $wordpressRegistry)
{
$this->wordpressRegistry = $wordpressRegistry;
@kayue
kayue / template.js
Created November 12, 2014 04:35
JS template engine
function t(s,d){
for(var p in d)
s=s.replace(new RegExp('{'+p+'}','g'),
typeof d[p][1]=='f' ? d[p]() : d[p]);
return s;
}
t("Hello {who}!", { who: "JavaScript" });
// "Hello JavaScript!"