Skip to content

Instantly share code, notes, and snippets.

View mschultheiss83's full-sized avatar

Martin Schultheiß mschultheiss83

View GitHub Profile
@mschultheiss83
mschultheiss83 / test.php
Last active October 12, 2015 13:58
Magento - Quick n Dirty - Test Scripts
<?php
/**
* Magento Test File
*
*/
error_reporting(E_ALL);
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
@mschultheiss83
mschultheiss83 / awesome-php.md
Created November 9, 2012 11:54 — forked from melihbuyuk/awesome-php.md
Awesome PHP Libraries
@mschultheiss83
mschultheiss83 / autobackupmongo.rb
Created November 10, 2012 02:14 — forked from ashayh/autobackupmongo.rb
auto backup mongo (ruby version and very concise)
#!/usr/local/ruby/bin/ruby -w
Dbpath = "/data/db" # database path
Backpath = "/data/dbbackup" # backup directory
Host = "" # mongo host to connect,empty is for local
Database = "" # database to use. empty is for all
Collection = "" # collection to use
User = ""
Passwd = ""
Now = Time.now
DATE = Now.strftime("%Y-%m-%d")
UPLOADCORE
http://www.uploadcore.com/yzjsyg8ercgt
http://www.uploadcore.com/wvs19j2cvi1p
http://www.uploadcore.com/oakdpstv2zze
http://www.uploadcore.com/ifbeetlqjh4w
http://www.uploadcore.com/h3qux54lurrv
http://www.uploadcore.com/awii8qjr5gkm
http://www.uploadcore.com/3rx7ypi8fbna
http://www.uploadcore.com/2udunk9dk3if
@mschultheiss83
mschultheiss83 / gist:4499800
Created January 10, 2013 06:03 — forked from sang4lv/gist:4499788
MySQLi example
<?php
function processURL($originalURL, $array) {
$base = "http://example.com";
$avail = "";
$link = new mysqli($host, $user, $pass, $daba);
if(mysqli_connect_errno()) {
die("Connection failed" . mysqli_connect_error());
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style type="text/css">
#nav {
width:960px;
background-color:#005500;
padding-top:5px;
display:table;
}
\documentclass[10pt,a4paper]{article}
\usepackage{multicol}
\usepackage{amsmath, amssymb, amsthm}
\usepackage[margin=.3in]{geometry}
\usepackage[normalem]{ulem}
\begin{document}
@mschultheiss83
mschultheiss83 / Mage::cleanup.php
Created February 11, 2013 11:01
Magento Cleanup Log-Tables and Cache-Files
<?php
/***************************************************
* Magento Log File Contents Monitor. GNU/GPL
* [email protected]
* provided without warranty or support
***************************************************/
/***********************
* Scan Magento local.xml file for connection information
--- a/app/code/core/Mage/Core/Model/App.php
+++ b/app/code/core/Mage/Core/Model/App.php
@@ -511,11 +511,7 @@ class Mage_Core_Model_App
if ($this->_currentStore == $store) {
$store = $this->getStore($store);
- if ($store->getWebsite()->getDefaultStore()->getId() == $store->getId()) {
- $this->getCookie()->delete(Mage_Core_Model_Store::COOKIE_NAME);
- } else {
- $this->getCookie()->set(Mage_Core_Model_Store::COOKIE_NAME, $this->_currentStore, true);
#!/bin/sh
branch=$(git branch 2>/dev/null | grep ^\*)
[ x$1 != x ] && tracking=$1 || tracking=${branch/* /}
git config branch.$tracking.remote origin
git config branch.$tracking.merge refs/heads/$tracking
echo "tracking origin/$tracking"