Skip to content

Instantly share code, notes, and snippets.

View mgmilcher's full-sized avatar

Marius Milcher mgmilcher

View GitHub Profile
@mgmilcher
mgmilcher / gist:9184511
Created February 24, 2014 09:29
Computer Science - Crib Sheet

#ACID

Atomicity

Atomicity requires that each transaction is "all or nothing": if one part of the transaction fails, the entire transaction fails, and the database state is left unchanged. An atomic system must guarantee atomicity in each and every situation, including power failures, errors, and crashes. To the outside world, a committed transaction appears (by its effects on the database) to be indivisible ("atomic"), and an aborted transaction does not happen.

##Consistency

The consistency property ensures that any transaction will bring the database from one valid state to another. Any data written to the database must be valid according to all defined rules, including but not limited to constraints, cascades, triggers, and any combination thereof. This does not guarantee correctness of the transaction in all ways the application programmer might have wanted (that is the responsibility of application-level code) but merely that any programming errors do not violate any defined rules.

@mgmilcher
mgmilcher / gist:9892489
Last active August 29, 2015 13:57 — forked from g3d/gist:2709563
OSX Chill Defaults
@mgmilcher
mgmilcher / gist:029e9ebe78cc2e6c8efa
Created April 30, 2015 10:01
WP Export Posts as JSON
<?php
include "wp-load.php";
$posts = new WP_Query('post_type=any&posts_per_page=-1&post_status=publish');
$posts = $posts->posts;
/*
global $wpdb;
$posts = $wpdb->get_results("
SELECT ID,post_type,post_title
<?
class AppController extends Controller {
var $sslRequired = array('login', 'logout');
var $sslAllowed = array('index');
var $beforeFilter = array('ensureProperProtocol');
private function sslRequired() {
return in_array($this->action, $this->sslRequired);
}
@mgmilcher
mgmilcher / range-finder.js
Created October 5, 2015 08:56
Range Finder
var x1 = 1;
var x2 = 100;
var y1 = 99;
var y2 = 1250100;
function rangeFinder(x1,x2,y1,y2) {
return Math.max(x1,y1) <= Math.min(x2,y2);
}
@mgmilcher
mgmilcher / pagination.ctp
Created June 4, 2012 16:15 — forked from slywalker/pagination.ctp
pagination element for CakePHP on twitter bootstrap
<?php
if (!isset($modules)) {
$modulus = 11;
}
if (!isset($model)) {
$models = ClassRegistry::keys();
$model = Inflector::camelize(current($models));
}
?>
<div class="pagination">
@mgmilcher
mgmilcher / samples.label
Created October 5, 2012 12:13
SLIMS Sample Label Template
<?xml version="1.0" encoding="utf-8"?>
<DieCutLabel Version="8.0" Units="twips">
<PaperOrientation>Portrait</PaperOrientation>
<Id>Shipping</Id>
<PaperName>30323 Shipping</PaperName>
<DrawCommands>
<RoundRectangle X="0" Y="0" Width="3060" Height="5715" Rx="270" Ry="270" />
</DrawCommands>
<ObjectInfo>
<TextObject>
@mgmilcher
mgmilcher / linux_crib_sheet.md
Last active October 12, 2015 10:08
Linux Crib Sheet

Linux Shortcuts

General Crib Sheet

Find a file

find / -name php.ini

Find Directory

@mgmilcher
mgmilcher / gist:5605936
Created May 18, 2013 22:11
Markdown Cheat Sheet. Originally created by from http://warpedvisions.org/projects/markdown-cheat-sheet/
# Header 1 #
## Header 2 ##
### Header 3 ### (Hashes on right are optional)
#### Header 4 ####
##### Header 5 #####
## Markdown plus h2 with a custom ID ## {#id-goes-here}
[Link back to H2](#id-goes-here)
This is a paragraph, which is text surrounded by whitespace. Paragraphs can be on one
wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
rpm --install rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install --enablerepo=rpmforge memcached
memcached -d -m 512 -l 127.0.0.1 -p 11211 -u nobody
wget http://pecl.php.net/get/memcache-2.2.5.tgz
tar -xvf memcache-2.2.5.tgz
cd memcache-2.2.5
phpize && ./configure --enable-memcache && make
cp /root/memcache-2.2.5/modules/memcache.so /usr/lib/php/modules/
echo extension=memcache.so >> /etc/php.ini