Skip to content

Instantly share code, notes, and snippets.

@ScreamingDev
ScreamingDev / badaboom.php
Last active December 23, 2015 13:39
The day I wanted to test against associative array ...
<?php
// php -r "var_dump(intval('foo'), intval('foo') == 'foo', 0 == 'foo', (bool) 'foo', 0 == true);"
var_dump(
intval('foo'), // 0
0 == 'foo', // true
'foo' == 0, // true
@ScreamingDev
ScreamingDev / split.tmp
Last active December 25, 2015 20:59
doppelt?
0 =>
array (
'_store' => '',
'sku' => '10153',
),
1 =>
array (
'_store' => 'en',
'sku' => '10153',
),
@ScreamingDev
ScreamingDev / git-unfold.sh
Last active December 26, 2015 01:09
Unfold changes into "deeper" branches
#!/bin/bash
# if you have branches like
# - dev-foo
# - dev-foo-bar
# - dev-foo-bar-baz
#
# then go in dev-foo and run "git unfold":
# - merges the origin branch (dev-foo) into all the others (dev-foo-bar, dev-foo-bar-baz)
@ScreamingDev
ScreamingDev / wp_plugins.sh
Created October 26, 2013 08:09
Find all WordPress Plugins Are you worried about the plugins that run in your wordpress? Did you read about some issues, bugs or hacks in a WP plugin? Fetch all you got installed and check whether they are infected or a security issue.
#!/bin/bash
###
# Run this from your document root
# It will search for "*/wp-content/plugins" folder and list everything in it.
###
# temporary file for found plugins
TFILE="/tmp/$(basename $0).$$.tmp"
@ScreamingDev
ScreamingDev / product.json
Created November 8, 2013 07:49
small image is 17833.png but the category list uses 34550.png - why?
{ "_media_image": "magpic/78398.png",
"_media_attribute_id": 88,
"_media_is_disabled": 0,
"_media_position": 2
},
{
"_media_image": "magpic/17833.png",
"_media_attribute_id": 88,
#!/bin/bash
#
# Get directory of the shell script itself
#
# Read the directory where the shell script is in
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Or resolve the symlink of the file if there is any
@ScreamingDev
ScreamingDev / array-fun.php
Created November 24, 2013 14:36
Err... okay...
<?php
$err = array();
var_dump((bool) $err);
// bool(false) - obvoius, it is empty
$err = array(null);
var_dump($err, (bool) $err, empty($arr));
/*
array(1) {
@ScreamingDev
ScreamingDev / go-live-git.md
Created December 5, 2013 15:19
Live stellen mit GIT

Läuft ein Schritt nicht wie gewohnt oder gibt es Schwierigkeiten, dann bescheid geben.

Pre-Disaster

  • Am Server anmelden und in das GIT-Verzeichnis gehen
    • Mit git branch prüfen auf welchem Branch die Instanz läuft. Das sollte "master" sein.
    • Mit git status prüfen ob Änderungen direkt auf dem Live-Server durchgeführt worden sind.
  • Wenn ja, dann mit git diff [dateiname] die Änderungen ansehen und
@ScreamingDev
ScreamingDev / default.yaml
Last active December 31, 2015 01:39
EcomDev_PHPUnit fixtures
config:
stores/default/dev/template/allow_symlink: 1
stores/admin/dev/template/allow_symlink: 1
@ScreamingDev
ScreamingDev / skeleton.sh
Last active January 1, 2016 12:28
Skeleton Bash Skript
#!/bin/bash
function Usage()
{
cat <<-ENDOFMESSAGE
Find old files
$0 [OPTION] PATH
DESCRIPTION