Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

<?php
// Page.php
class Page extends SiteTree {
public static $many_many = array(
'TestObjects' => 'TestObject'
);
public static $many_many_extraFields = array(
'TestObjects' => array(
@priithansen
priithansen / gist:2909528
Created June 11, 2012 10:46
Emhi weather extract
<?php
/* Simple HTML DOM Parser http://simplehtmldom.sourceforge.net/ */
include('simple_html_dom.php');
$html = file_get_html('http://www.emhi.ee/index.php?ide=21&v_kaart=0&go=5');
foreach($html->find('table[cellpadding=2] tr[bgcolor=#F7F7F7], tr[bgcolor=#FFFFFF]') as $row){
foreach($row->find('td') as $cell) {
<?php
class page_graafik extends Page {
function initMainPage(){
$this->api->stickyGET('mac');
//Get the maja id from maja table based on mac
$maja = $this->setModel('maja');
$maja->tryLoadBy('mac','=',$_GET['mac']);
@priithansen
priithansen / gist:2251372
Created March 30, 2012 13:03
Makibot php
<?php
include "php_serial.class.php";
$go = $_GET["go"];
// Let's start the class
$serial = new phpSerial;
// First we must specify the device. This works on both linux and windows (if
// your linux serial device is /dev/ttyS0 for COM1, etc)
@priithansen
priithansen / gist:2251359
Created March 30, 2012 13:02
Makibot html
<html>
<head>
<style type="text/css">
.nupud {
-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
box-shadow:inset 0px 1px 0px 0px #ffffff;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
@priithansen
priithansen / gist:2251279
Created March 30, 2012 12:45
Makibot Arduino code
boolean stringComplete = false; // whether the string is complete
String inputString = "";
void setup() {
// test pin
pinMode(10, OUTPUT); // Vasakule
pinMode(9, OUTPUT); // Paremale
// initialize serial: