Skip to content

Instantly share code, notes, and snippets.

# data trait
module Option
def list
all.sort.unshift(default)
end
def default
'all'
end
end
<?php
echo gethostname() . PHP_EOL;
!function_exists('apc_clear_cache') ? : apc_clear_cache();
!function_exists('apc_clear_cache') ? : apc_clear_cache('user');
!function_exists('opcache_reset') ? : opcache_reset();
class Booking
attr_reader :nights, :minibar_items, :room
def initialize nights, minibar_items, room
@nights = nights
@minibar_items = minibar_items
@room = room
end
def calculate_total_cost
-----BEGIN PGP MESSAGE-----
Comment: https://keybase.io/download
Version: Keybase Go 1.0.7 (darwin)
wcBMAxtrcaH3hcQXAQgAn5yMvw0smw7R5C5QBkIi8aWzVbb4ch2XNQQUXPr2Npc5
uZS95NokygefL8A8seLw5LCKuUFyS+vYrg7kNJ5Mjmfh/aeIjEJT7La1Et9tl+z1
GBtU/cXRQGL9m6K0uGb00BGv8r8GZQDU34Q9djMl2WWX8UuWINdXPzFgJFzLT6jT
RK/YQIVjVV95owxU3pwYZ6qFQekFcgk/N/5Tf/T4tKV4S+QkVOBIEltU6aG3gRaQ
YMkcOhd+EkfZodCzda+GBGtVISY3IOLSkF742ut3GPEwzDs9A5W3CGP2jNPYvTJg
94tAeOodYbWTWTEL0LQamPL4Ljpsdbbb6mD98nSAu9LgAeQIH78D548AV6BUtoj1

Keybase proof

I hereby claim:

  • I am ryaan-anthony on github.
  • I am ryaan (https://keybase.io/ryaan) on keybase.
  • I have a public key whose fingerprint is 88F0 7FB7 72AF 8653 688A 018E A46F 2085 4626 5A54

To claim this, I am signing this object:

<?xml version="1.0"?>
<config>
<placeholders>
<your_modules_holepunch_node>
<block>your_module/your_block</block>
<name>layout.name.for.your.block</name>
<container>Your_Module_Model_Container</container>
<placeholder>PLACEHOLDER_NAME_FOR_YOUR_CONTAINER</placeholder>
</your_modules_holepunch_node>
</placeholders>
@ryaan-anthony
ryaan-anthony / curl.out
Created December 17, 2015 15:20
Using CURL to make SOAP requests with Magento 1.x
$ cat login.xml
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<MAGE:login xmlns:MAGE="http://xxxxxx/api/v2_soap/?wsdl=1">
<MAGE:username>xxxxxx</MAGE:username>
<MAGE:apiKey>xxxxxx</MAGE:apiKey>
</MAGE:login>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
$ curl --data @login.xml http://xxxxxx/api/v2_soap
#!/bin/bash
if [ -z $1 ]
then
echo 'Sitemap must be provided as first argument.';exit 2
fi
# Helper function to read xml
read_dom () {
local IFS=\>
<?php
/**
* @param string
* @param string
* @param Mage_Core_Model_Store
* @throws Exception
*/
function createRedirect($fromUrl, $toUrl, Mage_Core_Model_Store $store)
{
@ryaan-anthony
ryaan-anthony / observer.php
Created November 6, 2015 19:08
handle various controllers from a single pre-dispatch
<?php
class Observer
{
public function handleControllerActionPredispatch(Varien_Event_Observer $observer)
{
$controllerAction = $observer->getEvent()->getControllerAction();
if ($controllerAction instanceOf Mage_Checkout_OnepageController) {
// currently handling a onepage checkout route