Skip to content

Instantly share code, notes, and snippets.

View OdinsHat's full-sized avatar
💭
Open to job offers

Doug OdinsHat

💭
Open to job offers
View GitHub Profile
@OdinsHat
OdinsHat / copyFiles.js
Last active August 29, 2015 14:14
Simply reads a file and outputs it to console.log/stdout
var fs = require('fs');
var file = fs.createReadStream('origin.txt');
var destFile = fs.createWriteStream('destination.txt');
// Not surte why end: false required as it seems silly to close midway through copying?
file.pipe(destFile, {end: false});
file.on('end', function(){
destFile.end('Finished!');
@OdinsHat
OdinsHat / bootstrap.sh
Created January 18, 2015 17:17
Example Vagrant Bootstrap file for an existing Magento install
#!/bin/sh
# Disable SELinux
sudo su
echo 0 >/selinux/enforce
setenforce Permissive
# Yum Update
sudo yum -y update
@OdinsHat
OdinsHat / Gruntfile.js
Created January 18, 2015 17:14
Example Magento Gruntfile.js
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
phplint: {
local: {
files: [{
expand: true,
cwd: 'app/code/local/',
@OdinsHat
OdinsHat / Magento.md
Last active April 22, 2018 07:12 — forked from grafikchaos/gist:9938618
Magento Cook book

Magento Snippets

Changing Order Status

// shipping_cdl setup in the admin area under shipping methods
$orderModel = Mage::getModel('sales/order');
$orderModel->reset()->load($orderId);
$orderModel->addStatusHistoryComment('Sent to CDL', 'shipping_cdl');
$orderModel->setStatus('shipping_cdl')->save();
@OdinsHat
OdinsHat / setup.sh
Created October 8, 2014 19:52
Local Dev Setup
#### NOTES: ####
# UNDER DEVELOPMENT
#Chrome
#Opera
#Firefox
# HomeBrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@OdinsHat
OdinsHat / setuplemp.sh
Created June 25, 2014 16:25
Quick instructions/script okn installing LEMP stack via homebrew
#!/bin/sh
### Install LEMP Stack on OSX Mavericks
# Make sure xcode CLI tools installed
xcode-select --install
# Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# Install nginx
@OdinsHat
OdinsHat / getstockfile.py
Last active August 29, 2015 14:02
Quick script written for reading our many company email for stock status updates from Kidkraft and then downloading the attached xlsx file for processing
#!/usr/bin/env python
import email
import imaplib
import os
import sys
detach_dir = '.' # directory where to save attachments (default: current)
files = os.listdir('.')
@OdinsHat
OdinsHat / gendepotcodes.py
Last active August 29, 2015 14:01
Scripts for generating unique numbers for garage depots for use in text campaigns. One script for creating XLS file and another for separate CSV files
#!/usr/bin/env python
"""
Generates URN/codes and saves them to separate CSV files - 1 for each depot.
URN Format: (\d{3})([A-Z])(\d{3})
Group 1: Random capital letter A-Z (technically unecessary)
Group 2: Depot number 01-67
Group 3: Sequence number 001-250 (never repeats)
"""
@OdinsHat
OdinsHat / memoization.js
Created May 18, 2014 08:50
Javascript Memoization Example from Javascript the Good Parts
var memoizer = function (memo, formula) {
var recur = function (n) {
var result = memo[n];
if (typeof result !== 'number') {
result = formula(recur, n);
memo[n] = result;
}
return result;
};
return recur;
@OdinsHat
OdinsHat / getstockfile.py
Created May 18, 2014 08:12
Quick & dirty script used for downloading latest stock sheet from Google Apps Email and saving to server for further processing
#!/usr/bin/env python
""" Quick & dirty script used for downloading latest stock sheet from
Google Apps Email and saving to server for further processing"""
import email
import imaplib
import os
save_dir = '.'