Skip to content

Instantly share code, notes, and snippets.

@SemanticallyNull
SemanticallyNull / if.c
Created November 6, 2011 13:38
Finally began messing around with C... much is coming back to me now, and realising how little I know.
#include <stdio.h>
int main(void) { // Thanks to @barrettcolin for showing me the way.
int age;
printf("What is your age? ");
scanf("%d", &age); // Accept a numeric input and push it to age (by getting the lvalue of age)
if(age < 5) {
printf("Wow, you're very young!\n");
} else if(age < 12) {
@SemanticallyNull
SemanticallyNull / average.c
Created November 7, 2011 11:22
More C... when will it end?
#include <stdio.h>
int main() {
int age;
int sum = 0;
float avrg;
int x;
printf("I'm going to ask 10 people for their age and then find the average\n");
printf("of their ages at the end, just for fun!\n\n");
alert('test');
<?
Configure::write('Session', array(
'defaults' => 'php',
'ini' => array(
'session.save_handler' => 'redis',
'session.save_path' => 'redis://xxxxx.redistogo.com:xxxx?auth=xxxx'
)
));
@SemanticallyNull
SemanticallyNull / index.php
Created April 13, 2012 16:32
Alternative index.php for Sapphire-CMS/SilverStripe
<?php
/************************************************************************************
************************************************************************************
** **
** If you can read this text in your browser then you don't have PHP installed. **
** Please install PHP 5.0 or higher, preferably PHP 5.2. **
** **
************************************************************************************
************************************************************************************/
<?php
header('Content-Type: text/xml');
echo '<?xml version=\'1.0\' encoding=\'utf-8\' ?>';
?>
<Response>
<Say>
This is an automated call to alert you to an outage. Details follow.
</Say>
<Pause length="2" />
<Say>Type: <?=$_GET["type"]?>.</Say>
error_page 405 =200 @four_oh_five;
location @four_oh_five {
if (!-f $request_filename) {
return 404;
}
proxy_method GET;
proxy_pass http://localhost:80;
}
@SemanticallyNull
SemanticallyNull / index.md
Created July 25, 2012 00:04
Developing for Cloud

Separating services out

Cost vs Value

@SemanticallyNull
SemanticallyNull / index.html
Created August 9, 2012 16:34
HTTPS Login site
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Bootstrap, from Twitter</title>
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.0.4/css/bootstrap-combined.min.css" rel="stylesheet">