Skip to content

Instantly share code, notes, and snippets.

View birkir's full-sized avatar
👋
Howdy

Birkir Gudjonsson birkir

👋
Howdy
View GitHub Profile
<html>
<?php if ($item == TRUE): ?>
<div id='test'>
<?php foreach ($items as $item): ?>
<?php echo 'foobar'; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
</html>
<?php
system("stty -icanon");
define('LINE_RETURN', "\n");
class Console {
// Input prompt
public static $pi = "\033[36m>>\033[37m ";
<table border="0" cellpadding="0" style="font-family: 'Arial';">
<tbody>
<tr>
<td style="border:none;border-right:solid #FABF8F 1.0pt;padding:.75pt 16.5pt .75pt .75pt"><img src="http://domusnova.is/img/signature.gif"></td>
<td style="border:none;border-right:solid #FABF8F 1.0pt;padding:.75pt 16.5pt .75pt 16.5pt">
<p>
<span style="font-size:18.0pt;">Bóas Ragnar Bóason</span>
<br />
<span style="font-size:10.0pt;color:#595959">Sölustjóri</span>
</p>
<?php
$total = 10000;
$count = 0;
$start = (float) array_sum(explode(' ',microtime()));
for($i = 0; $i <= $total; $i++)
{
@birkir
birkir / media.php
Created December 2, 2010 10:15
Media Controller for my lovely Media system
<?php defined('SYSPATH') or die('No direct script access.');
/**
* Handles all media the website will ever have to need. It minifies all
* javascript and stylesheets. Then it compresses every file to gzip and outputs
* it to the browser, if he accepts it.
*
* @package OpenTorrent
* @category Controllers
* @author Birkir R Gudjonsson <birkir.gudjonsson@gmail.com>
* @copyright Copyright (c) 2010, Birkir R Gudjonsson
@birkir
birkir / kohana.php
Created January 14, 2011 13:28
execute: "php kohana.php"
<?php
function input()
{
$handle = fopen("php://stdin", "r");
return fgets($handle);
}
function fetch($url = NULL)
{
$ch = curl_init();
@birkir
birkir / mysqli.php
Created February 14, 2011 11:39
MySQLi
<?php
$mysqli = mysqli_connect('localhost', 'user', 'pass', 'database');
if (mysqli_connect_errno())
{
print('Gat ekki tengst.');
}
if ($stmt = $mysqli->prepare('INSERT INTO `users` (`name`, `username`, `email`, `password`) VALUES (?, ?, ?, ?)'))
<?php
$insert = array(
'name' => 'John Doe',
'username' => 'john',
'email' => 'john@doe.com',
'password' => hash('sha256', 'password', TRUE)
);
$db = DB::insert('users')
<?php defined('SYSPATH')or die('No access');
class Controller_Sites extends Controller_Template {
public function action_index()
{
$sites = ORM::factory('site')->sites()->find_all();
}
}
<?php
$gengi = array();
$xml = file_get_contents('http://vefafgreidsla.tollur.is/tollalina/gengi/Innflutningur.aspx');
$xml = new SimpleXMLElement(str_replace('xmlns="tollalinan/WS/Schema/DSGengi.xsd"', NULL, $xml));
foreach ($xml->DSGengi->MyntOgGengi as $item)
{
$gengi[strtolower($item->Mynt)] = (double) $item->Gengi;
}