Skip to content

Instantly share code, notes, and snippets.

@clowestab
clowestab / gist:b94e4c1c48db42bf4b91
Created April 6, 2015 18:15
Phalcon transaction issue
for ($i = 0; $i < 5; $i++) {
echo $i;
$transaction = $this->transactionManager->get();
$pub = new Pub();
$pub->setTransaction($transaction);
$pub->save();
$feature = new PubFeature();
$feature->setTransaction($transaction);
@clowestab
clowestab / solidity-struct-multiple-string-bug.sol
Created February 4, 2016 17:21
Demonstrates the bug in Solidity which results in structs not being correctly stored in mappings.
contract Whois {
mapping(bytes32 => Address) addresses;
//Struct representing a postal address
struct Address {
bool initialized;
@clowestab
clowestab / PRListView
Last active March 2, 2016 14:41
A simple but complete Android pull to refresh/load more ListView implementation.
package com.package
import android.animation.Animator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@clowestab
clowestab / UpdateGhost.sh
Created August 9, 2016 16:59
A simple script for automatically updating a Ghost blog on an external server.
#!/bin/bash
START=$(date +%s)
STAGEDIR=/Path/ghost-new/
# We will send them to this host
HOST=123.456.789
USERNAME=username
@clowestab
clowestab / gist:ea8eaa99c5c4153b2346
Created February 22, 2015 15:07
FIX: Nested fragments not retained in latest support library releases
public class BaseFragment extends Fragment {
private FragmentManager mRetainedChildFragmentManager;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
0x5608aA3DC0F3Db4617714e6a11a8f8004c255B88
expect(resultCount).to.be.above(0);
(function() {
var color = Mocha.reporters.Base.color;
function log() {
var args = Array.apply(null, arguments);
if (window.callPhantom) {
window.callPhantom({ message: args.join(" ") });
} else {
var page = require("webpage").create();
var args = require('system').args;
//pass in the name of the file that contains your tests
var testFile = args[1];
//pass in the url you are testing
var pageAddress = args[2];
if (typeof testFile === 'undefined') {
console.error("Did not specify a test file");