Skip to content

Instantly share code, notes, and snippets.

View bobbyshaw's full-sized avatar

Tom Robertshaw bobbyshaw

View GitHub Profile
@vrann
vrann / install-magento-docker.MD
Last active June 1, 2018 14:55
Install Magento from GitHub on Docker

Prerequisites

Docker is installed

1. Start Docker Cluster

  1. create directory ~/magento2-docker
  2. add docker-compose.yml to ~/magento2-docker with the following content
version: '3'
services:
@PhilippLgh
PhilippLgh / Bot.js
Created April 18, 2016 13:15
A Telegram Speech-To-Text bot that uses Watson
var Bot = require('node-telegram-bot-api')
var watson = require('watson-developer-cloud');
var request = require('request');
var config = require('./config');
var speech_to_text = watson.speech_to_text({
username: config.watson.username,
password: config.watson.password,
version: 'v1',
url: 'https://stream.watsonplatform.net/speech-to-text/api'
@harlesc
harlesc / PHP7 Magento 1.9 core patch.md
Last active April 9, 2017 20:31
Patch to get Magento 1.9 working with >= PHP 7.0.0 RC 6

Patch using method below or if you don't want to patch a core file, see this Magento extension that does the same thing but correctly overrides the core file:
https://github.com/MageMechanic/PhpSeven

# run in magento root directory

# one-liner to apply patch using wget
wget -qO- 'https://gist.githubusercontent.com/MageMechanic/66449504110fbbd96214/raw/php7_magento_1_9_core.patch' | patch -p0

# one-liner to apply patch using curl
@wsakaren
wsakaren / install_mag2_db_cli
Created July 30, 2015 08:36
Install Magento 2 Merchant Beta with database - quick route via command line
cd htdocs
composer create-project magento/community-edition magento2 1.0.0-beta --prefer-dist
create db (see details below)
Edit setup/index.php && index.php and add this - ini_set('xdebug.max_nesting_level', 200);
bin/magento setup:install --base-url=http://127.0.0.1/magento2/ \
--db-host=localhost --db-name=magento --db-user=magento --db-password=magento \
--admin-firstname=Magento --admin-lastname=User --admin-email=user@example.com \
@alistairstead
alistairstead / local.xml
Created November 1, 2014 12:09
Disable the automatic application of update scripts on each page request following cache clear. Use MageRun to apply the upgrades manually within a controlled step.
<?xml version="1.0"?>
<config>
<global>
<skip_process_modules_updates>1</skip_process_modules_updates>
</global>
</config>
@hdragomir
hdragomir / sm-annotated.html
Last active March 5, 2024 08:57
The deferred font loading logic for Smashing Magazine. http://www.smashingmagazine.com/
<script type="text/javascript">
(function () {
"use strict";
// once cached, the css file is stored on the client forever unless
// the URL below is changed. Any change will invalidate the cache
var css_href = './index_files/web-fonts.css';
// a simple event handler wrapper
function on(el, ev, callback) {
if (el.addEventListener) {
el.addEventListener(ev, callback, false);
@lgladdy
lgladdy / banes-ishare.php
Last active May 27, 2018 20:46
BANES Council Data from iShare
$pc = 'ba11be';
//HACKY HACKY. GET the first properly in the postcode.
$url = 'http://isharemaps.bathnes.gov.uk/getdata.aspx?service=LocationSearch&RequestType=LocationSearch&location='.$pc.'&pagesize=1&startnum=1';
$data = json_decode(file_get_contents($url),true);
$x = $data['data'][0][4];
$y = $data['data'][0][5];
$id = $data['data'][0][0];
<?php
/**
* Drop this into the shell directory in the Magento root and run without any arguments.
*/
require_once 'abstract.php';
/**
* Clean up the 1.6.1 sample data to work with the 1.8 CE url key constraints.
@fbrnc
fbrnc / Add hostname to hosts file
Last active December 16, 2015 12:49
Sending mails in php is slow on your dev machine? Add the hostname to the first line (where "localhost" is) in /etc/hosts. For some reason adding a separate line for your hostname does not have any effect. Find our what your hostname is using "hostname" on commandline. Quick test from command line: php -r 'mail("insertyourmailaddress@gmail.com",…
$ sudo vi /etc/hosts
# make sure your hostname goes in the first line
127.0.0.1 localhost.localdomain localhost addyourhostnamehere
...
@lgladdy
lgladdy / twitter-application-only-auth.php
Created March 12, 2013 09:46
A working example of Twitter's new application-only auth, written in PHP.
<?php
//This is all you need to configure.
$app_key = '';
$app_token = '';
//These are our constants.
$api_base = 'https://api.twitter.com/';
$bearer_token_creds = base64_encode($app_key.':'.$app_token);