Skip to content

Instantly share code, notes, and snippets.

View bucha's full-sized avatar
😾

Alexander Buch bucha

😾
View GitHub Profile
@bruce
bruce / query.graphql
Created March 27, 2017 21:37
Adding a count to an absinthe_relay Connection
{
items(first: 5) {
count
edges {
node {
name
}
}
}
}
@cmuench
cmuench / magento.xml
Last active July 23, 2018 05:39
PHPStorm Live Templates for Magento 2 (copy xml content to clipboard and paste it in a template group)
<template name="magento2:__" value="&lt;?php echo __('$SELECTION$'); ?&gt;" description="Translation" toReformat="false" toShortenFQNames="true">
<context>
<option name="HTML" value="true" />
<option name="PHP" value="true" />
</context>
</template>
<template name="magento2:collection" value="class Collection extends AbstractCollection&#10;{&#10; /**&#10; * Initialize resource model&#10; *&#10; * @return void&#10; */&#10; protected function _construct()&#10; {&#10; $this-&gt;_init($model$::class, $resourceModel$::class);&#10; }&#10;}" toReformat="true" toShortenFQNames="true">
<variable name="model" expression="" defaultValue="" alwaysStopAt="true" />
<variable name="resourceModel" expression="" defaultValue="" alwaysStopAt="true" />
<context>
@alces
alces / ansible_local_playbooks.md
Last active April 5, 2024 18:28
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@colinmollenhour
colinmollenhour / Varien.php
Last active December 19, 2017 15:08
Mage_Core_Model_Session_Abstract_Varien - dropped session fix
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
@scrogson
scrogson / README
Last active March 13, 2020 13:56 — forked from ciastek/README
Use bootstrap-sass npm package with Phoenix's brunch
1) install npm packages
2) update brunch-config.js
3) remove Bootstrap from web/static/css/app.css
4) rename web/static/css/app.css to web/static/css/app.scss
5) update web/static/css/app.scss
@mikob
mikob / AWS, ELB, CF and Let's Encrypt
Last active February 15, 2024 13:47
AWS, ELB, Let's Encrypt
Elastic Load Balancer, CloudFront and Let's Encrypt
@julianxhokaxhiu
julianxhokaxhiu / pagespeed_optimize_images.sh
Last active April 15, 2024 22:49
Recursively optimize all PNG and JPG files wherever they are from the script position and inner ( based on OPTING, PNGCRUSH, ADVANCECOMP and JPEGOPTIM )
#!/bin/bash
# Improved as per feedback from @pascal - https://gist.github.com/julianxhokaxhiu/c0a8e813eabf9d6d9873#gistcomment-3086462
find . -type f -iname "*.png" -exec optipng -nb -nc {} \;
find . -type f -iname "*.png" -exec advpng -z4 {} \;
find . -type f -iname "*.png" -exec pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB -rem time -ow {} \;
find . -type f \( -iname "*.jpg" -o -iname "*.jpeg" \) -exec jpegoptim -f --strip-all {} \;
@chrismdp
chrismdp / s3.sh
Last active March 5, 2024 12:57
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1
@aleron75
aleron75 / shell_delete_unused_images
Last active October 24, 2023 19:59
Delete no more used Product Images on Magento 1
<?php
require_once 'abstract.php';
class Mage_Shell_CheckImages extends Mage_Shell_Abstract
{
const CATALOG_PRODUCT = '/catalog/product';
const CACHE = '/cache/';
protected function _glob_recursive($pattern, $flags = 0)
@danharper
danharper / 1.Bus.js
Last active May 17, 2022 15:20
JavaScript Command Bus
const handlers = Symbol('handlers');
// adapts a handler class to a common interface
// (technically this one isn't required - the handler class already implements the same interface)
class ClassDispatchable {
constructor(theClass) {
this.theClass = theClass;
}
handle(command) {
return (new this.theClass).handle(command);