Skip to content

Instantly share code, notes, and snippets.

@rndstr
rndstr / go.md
Last active September 29, 2017 08:18
Go cheatsheet

Go operator precedence

1. *   /   %  <<  >>  &  &^
2. +   -   |  ^
3. ==  !=  <  <=  >   >=
4. &&
5. ||
@rndstr
rndstr / PreventIpViolationProcessor.java
Created May 9, 2016 09:40
PreventIpViolationProcessor for UniversalImageLoader (Android)
package me.schilter.faactors.service;
import android.graphics.Bitmap;
import com.nostra13.universalimageloader.core.process.BitmapProcessor;
/**
* Replaces an image with a single color version. To create screnshots
* for the Google Play Store listing with images you don't own the IP for.
*
@rndstr
rndstr / GAME_API.lua
Last active March 1, 2017 21:34
jserver API && example game
-- * attach functions to our existing cGame class. ('cGame:_blah') Use a preceeding underscore to make sure there is no name clash.
-- * access the game instance through 'g'
-- * access global exported C++ functions:
-- j_log( string )
-- write to jserver log stream (you may not use '\n', a newline is appended automatically on each function call)
-- NOTE: for tablelog use g:log() and g:log_debug()
-- j_stackdump() -- dumps the stack
--
-- * convention:
-- send_* - needs the client_idx as first argument (NOTE not id!)
@rndstr
rndstr / ObservableScrollView.java
Created February 21, 2014 11:08
vertical parallax image scroller
package me.schilter.faactors.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* ScrollView with a callback
*
* @author Roland Schilter <roli@schilter.me>
import android.util.Log;
import java.util.Arrays;
/**
* Sample usage:
*
* class MyApp extends Application {
* private Api sApi;
* private RequestLimiter sRequestlimiter = new RequestLimiter(5, 1000);
*
--- lib/Zend/Db/Statement/Pdo.php.orig 2011-11-01 13:48:26.700222766 +0100
+++ lib/Zend/Db/Statement/Pdo.php 2011-11-01 13:56:47.350239416 +0100
@@ -223,6 +223,38 @@
*/
public function _execute(array $params = null)
{
+ // Attempts to catch deadlocks and retry the query up to 10 times
+
+ $tries = 0;
+ do {
--- enterprise-1.11.0.0/app/code/core/Mage/Bundle/Model/Product/Price.php.orig 2011-09-13 15:46:40.003021295 +0200
+++ enterprise-1.11.0.0/app/code/core/Mage/Bundle/Model/Product/Price.php 2011-09-13 15:46:44.926354600 +0200
@@ -215,14 +215,12 @@
$selectionMinimalPrices[] = Mage::helper('tax')->getPrice(
$item,
$this->getSelectionFinalTotalPrice($product, $selection, 1, $qty, true, $takeTierPrice),
- $includeTax,
- $takeTierPrice
+ $includeTax
);
pcm.!default {
type hw
card PCH
device 7
}
ctl.!default {
type hw
card PCH
device 7
}
# line 367, magento-1.5.0.1
public function addItem(Varien_Object $item)
{
$itemId = $this->_getItemId($item);
if (!is_null($itemId)) {
if (isset($this->_items[$itemId])) {
throw new Exception('Item ('.get_class($item).') with the same id "'.$item->getId().'" already exist');
}
$this->_items[$itemId] = $item;
Index: app/code/core/Mage/Sales/Model/Order/Config.php
===================================================================
--- app/code/core/Mage/Sales/Model/Order/Config.php (revision 47050)
+++ app/code/core/Mage/Sales/Model/Order/Config.php (working copy)
@@ -171,7 +171,7 @@
foreach ($this->getNode('states')->children() as $state) {
$name = $state->getName();
$this->_states['all'][] = $name;
- if ($state->visible_on_front){
+ if ((int)$state->visible_on_front){