Skip to content

Instantly share code, notes, and snippets.

View nflint's full-sized avatar

Nate Flint nflint

View GitHub Profile
function psuedo_json_to_array($psuedo_json)
{
//Check if this is suedo json. If not exit with notice.
if (strpos($psuedo_json,"<=") !== false && strpos($psuedo_json,"=>") !== false){
$psuedo_json = str_replace("<=", "{", $psuedo_json);
$json_string = str_replace("=>", "}", $psuedo_json);
$json_errors = json_validate($json_string);
//This will take care of the rest if the inside does not have the correct formatting.
@nflint
nflint / languages.phtml
Created December 2, 2015 20:59
M7 Magento Language Changer
<?php
/**
* Magento
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE_AFL.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
@nflint
nflint / Page.php
Created December 29, 2015 03:28
Magento CMS Resource DIsable Exceptions : app/code/core/Mage/Cms/Model/Resource/Page.php
<?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
@nflint
nflint / magerun-install.sh
Created March 8, 2016 15:46
magerun installation script
#!bin/bash
#Installing on Mac or Linux (sets the magerun command to “magerun” for brevity)
# first cd into your /usr/local/bin
cd /usr/local/bin
# download the latest copy from magerun
curl -L -o n98-magerun.phar http://files.magerun.net/n98-magerun-latest.phar
# now make the file executable
chmod +x ./n98-magerun.phar
# change the name of the file so the commands are a little cleaner
mv n98-magerun.phar magerun
@nflint
nflint / sku-cleanup.php
Last active March 21, 2016 21:36
Magento Sku Cleanup Script
<?php
# Thanks to: http://stackoverflow.com/questions/28350783/how-to-replace-the-sku-number-for-5000-products-in-magento
# Create a CSV File with column "old_sku" in the first column, and "new_sku"in the second column.
include_once './app/Mage.php';
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
$updates_file="sku-cleanup.csv";
$sku_entry=array();
$updates_handle=fopen($updates_file, 'r');
if($updates_handle) {
@nflint
nflint / simpleSKUURL.php
Created April 22, 2016 18:47
Create CSV with url
<?php
$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::app();
$OutFile = Mage::getBaseDir ().DS."var/export/urls" .".csv";
$manufacturer_id = $argv[1];
if ( file_exists( $OutFile ) ){
@nflint
nflint / git-export-untracked-files.sh
Created May 13, 2016 20:00
Git command to export untracked files.
git ls-files --others --exclude-standard -z | cpio -pmd0 path/to/directory
git clean -d -f
# git ls-files: print a
# * null-delimited (-z) list of
# * untracked (--others)
# * non-ignored (--exclude-standard) files.
# cpio:
# * copy (-p)
# * files in a null-delimited list (-0)
@nflint
nflint / git-export-untracked-files.sh
Created May 13, 2016 20:01
Git command to export untracked files.
git ls-files --others --exclude-standard -z | cpio -pmd0 path/to/directory
git clean -d -f
# git ls-files: print a
# * null-delimited (-z) list of
# * untracked (--others)
# * non-ignored (--exclude-standard) files.
# cpio:
# * copy (-p)
# * files in a null-delimited list (-0)
// Uses this script: https://limonte.github.io/sweetalert2/
var footernewsletterSubscriberFormDetail = new VarienForm("footer-newsletter-validate-detail"),
val_form = new VarienForm("footer-newsletter-validate-detail");
jQuery("#footer-newsletter-validate-detail").submit(function(e) {
if (val_form.validator && val_form.validator.validate()) {
var t = jQuery(this).serializeArray(),
o = jQuery(this).attr("action"),
r = swal({
title: "One moment please...",
showCancelButton: !0,
@nflint
nflint / gdrive-listall.js
Last active February 15, 2020 06:37
List all files in a given folder on Google Drive
/* /**
* Google Apps Script - List all files & folders in a Google Drive folder, & write into a speadsheet.
* - Main function 1: List all folders
* - Main function 2: List all files & folders
*
* Hint: Set your folder ID first! You may copy the folder ID from the browser's address field.
* The folder ID is everything after the 'folders/' portion of the URL.
*
* @version 1.0