Skip to content

Instantly share code, notes, and snippets.

Brendan McKenzie brendanmckenzie

Block or report user

Report or block brendanmckenzie

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:11400011
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(1)
last_z := z
View awesome.cs
using System;
using System.Collections.Generic;
using System.Linq;
public static class Program
{
public static void Main()
{
var names = new List<string> { "Alice", "Bob", "Charley", "Derp", "Ed", "F" };
View gist:99d4df16f845eefb5dd6
[root@apacheserver ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d4bc7
Device Boot Start End Blocks Id System
View index.php
<?php
if (isset($_POST['submit'])) {
$user = '...';
$pass = '...';
$dbh = new PDO('mysql:host=xxx;port=xxx;dbname=xxx', $user, $pass);
$stm = $dbh->prepare('insert into customer ( name, email, dob, last_updated ) values ( :name, :email, :dob, current_timestamp )');
$stm->bindParam(':name', $_POST['name']);
$stm->bindParam(':email', $_POST['email']);
View fizzbuzz.comp.c
int main(){for(int i=1;i++<=100;){printf("%s%s",i%3==0?"Fizz":"",i%5==0?"Buzz":"");printf(!((i%5==0)||(i%3==0))?"%d":"",i);printf("\n");}}
View fizzbuzz.c
#include <stdio.h>
int main() {
int i;
for (i = 1; i <= 100; i++) {
if ((i % 3) == 0 && (i % 5) == 0) {
printf("FizzBuzz\n");
}
else if (i % 3 == 0) {
printf("Fizz\n");
View cidr.cs
public enum CidrGroup
{
Local,
Australia,
NewZealand
}
/// <summary>
/// Provides an easy interface for determining whether CIDR blocks contain specified IP addresses
/// </summary>
/// <remarks>
View editQuestion.php
<?php
function buildResult() {
return array('result' => 'Joy to the world');
}
header('Content-type: application/json');
echo json_encode(buildResult());
View main.d
import std.algorithm;
import std.array;
import std.csv;
import std.stdio;
import std.typecons;
import std.stream;
import std.path;
import std.string;
import std.file;
View gist:68e3744c5d4e38010cd8
begin transaction;
create table "user" (
id serial not null
constraint pk_user primary key,
password bytea null,
created timestamp
);
create table "user_email" (
You can’t perform that action at this time.