Skip to content

Instantly share code, notes, and snippets.

View adammck's full-sized avatar

Adam Mckaig adammck

View GitHub Profile
@adammck
adammck / example.sql
Created February 6, 2014 03:53
Track updated rows across multiple tables with Postgres
CREATE SEQUENCE sync_id;
CREATE FUNCTION bump_sync_id() RETURNS trigger AS $$
begin
NEW.sync_id := nextval('sync_id');
RETURN NEW;
END;
$$ LANGUAGE PLPGSQL;
CREATE TABLE dogs (id SERIAL, name VARCHAR NOT NULL, sync_id INTEGER NOT NULL);
<!DOCTYPE html>
<html>
<head>
<style>
* {
box-sizing: border-box;
}
body {
--- FAIL: TestCommentsStandalone (0.00 seconds)
mustache_test.go:52: returned "Begin.\n\nEnd.\n",
expected "Begin.\nEnd.\n"
--- FAIL: TestCommentsIndentedStandalone (0.00 seconds)
mustache_test.go:63: returned "Begin.\n \nEnd.\n",
expected "Begin.\nEnd.\n"
--- FAIL: TestCommentsStandaloneLineEndings (0.00 seconds)
mustache_test.go:74: returned "|\r\n\r\n|",
--- FAIL: TestInterpolationAmpersand (0.00 seconds)
mustache_test.go:375: returned "These characters should not be HTML escaped: \n",
expected "These characters should not be HTML escaped: & \" < >\n"
--- FAIL: TestInterpolationAmpersandIntegerInterpolation (0.00 seconds)
mustache_test.go:411: returned "\" miles an hour!\"",
expected "\"85 miles an hour!\""
--- FAIL: TestInterpolationAmpersandDecimalInterpolation (0.00 seconds)
mustache_test.go:447: returned "\" jiggawatts!\"",
@adammck
adammck / remaining_failures.txt
Created March 18, 2014 01:36
The remaining failures on the test_against_spec branch of my mustache.go fork
--- FAIL: TestCommentsStandalone (0.00 seconds)
mustache_test.go:44: returned "Begin.\n\nEnd.\n",
expected "Begin.\nEnd.\n"
--- FAIL: TestCommentsIndentedStandalone (0.00 seconds)
mustache_test.go:55: returned "Begin.\n \nEnd.\n",
expected "Begin.\nEnd.\n"
--- FAIL: TestCommentsStandaloneLineEndings (0.00 seconds)
mustache_test.go:66: returned "|\r\n\r\n|",
# select * from users;
id | name | personality
----+---------+-------------
1 | adam | f
2 | bob | f
3 | charles | t
(3 rows)
# select * from things;
id | name | owner_id
package main
import (
"flag"
"fmt"
"io"
"log"
"net/http"
)
#!/usr/bin/env python
import re
import sys
import urllib2
from datetime import datetime
print "# Generated by %s at %s" % (sys.argv[0], datetime.now())
print
{
"rows": [
[7, 3, 1, 1, 7],
[1, 1, 2, 2, 1, 1],
[1, 3, 1, 3, 1, 1, 3, 1],
[1, 3, 1, 1, 6, 1, 3, 1],
[1, 3, 1, 5, 2, 1, 3, 1],
[1, 1, 2, 1, 1],
[7, 1, 1, 1, 1, 1, 7],
[3, 3],
diff --git a/src/parser.c b/src/parser.c
index afbfed5..0f459f2 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -332,7 +332,7 @@ int parse_line(struct prog_info *pi, char *line)
}
return(True);
}
- strcpy(pi->fi->scratch, &pi->fi->scratch[i]);
+ memmove(pi->fi->scratch, &pi->fi->scratch[i], strlen(&pi->fi->scratch[i])+1);