Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Rabea Abdelwahab RabeaWahab

View GitHub Profile
View yamile.js
/*
* The weathermap application.
*/
var express = require('express');
var request = require('request');
// Rabea: checkout out Dotenv module, it is a better way of handling creds
var config = require('./config');
var app = express();
View cancel.php
public function retrieveCoupon($observer)
{
$payment = $observer->getEvent()->getPayment();
$order = $payment->getOrder();
if ($code = $order->getCouponCode()) {
$coupon = Mage::getModel('salesrule/coupon')->load($code, 'code');
$coupon->setTimesUsed($coupon->getTimesUsed()-1);
$coupon->save();
View pi.go
package main
import (
"fmt"
"math/rand"
"time"
"runtime"
)
func init() {
View dalek_report.js
{
"tests": [
{
"id": "test2",
"name": "EXAMPLE.com HomePage",
"browser": "PhantomJS",
"status": true,
"passedAssertions": 5,
"failedAssertions": 0,
"actions": [
View dalek_homepage.js
module.exports = {
'EXAMPLE.com HomePage': function (test) {
// Just a random number
var now = Math.floor(Date.now() / 1000);
test
// Open EXAMPLE.com
.open('http://www.EXAMPLE.com')
View CategoryAttribute.php
$this->startSetup();
/**
* Use those two commands to delete the attribute for testing
*/
//$this->removeAttribute('catalog_category', 'custom_attribute_1');
//$this->removeAttribute('catalog_category', 'custom_attribute_2');
// creating the attributes
View Sheet.html
<table>
<thead>
<tr><th>File Path</th>
<th>Event</th>
</tr></thead>
<tbody>
<tr>
<td>app/code/core/Mage/Customer/Model/Address/Abstract.php</td>
<td> 'customer_address_format'</td>
</tr>
View MagentoOneStepCoupon.php
public function couponPostAction()
{
/**
* No reason continue with empty shopping cart
*/
if ($this->_expireAjax()) {
return;
}
View MonitRedis.conf
check process redis with pidfile /var/run/redis/redis.pid
start program = “/etc/init.d/redis start”
stop program = “/etc/init.d/redis stop”
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then alert
View GoogleAnalytics.php
<?php
use UnitedPrototype\GoogleAnalytics;
// initiate the tracker
$tracker = new GoogleAnalytics\Tracker($accountId, $account_domain);
// Assemble Visitor information
// (could also get unserialized from database)
$visitor = new GoogleAnalytics\Visitor();
$visitor->setIpAddress($_SERVER['REMOTE_ADDR']);
You can’t perform that action at this time.