Skip to content

Instantly share code, notes, and snippets.

/**
* Parses JSON request bodies, populates $_POST
* for queries like PUT, PATCH, etc...
*/
public static function preprocessInput()
{
if ($_SERVER['HTTP_CONTENT_LENGTH'] == 0) // empty request
return;
$is_json = preg_match(self::$content_type_json, $_SERVER['HTTP_CONTENT_TYPE']);
/**
* Package implements a queue structure with task state tracking.
* Task can have 4 states:
* * Confirmed. When task was processed successfully it is confirmed.
* Confirm() function removes task from queue.
*
* * Discarded. Removed from queue, discarded flag set.
* Pretty much the same as Confirmed,
* just with differrent name to indicate cancellation
* of processing
This file has been truncated, but you can view the full file.
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x40 pc=0x46bec9]
goroutine 11861 [running]:
runtime.panic(0x6598a0, 0x9a3588)
/usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
github.com/PuerkitoBio/goquery.NewDocumentFromResponse(0x0, 0x0, 0x0, 0x0)
/home/naquad/projects/prices-go/src/github.com/PuerkitoBio/goquery/type.go:56 +0x39
main.parseList(0xc210037360, 0x0)
/home/naquad/projects/prices-go/main.go:123 +0x32
package main
import (
"fmt"
"net/http"
"net/url"
"io"
"github.com/PuerkitoBio/goquery"
)
package client
import (
"net/http"
"io"
)
import _ "code.google.com/p/go-charset/data"
type ClientCallback func(*Client, Response)
@naquad
naquad / -
Created March 15, 2014 23:13
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x38 pc=0x438d2c]
goroutine 3 [running]:
runtime.panic(0x6246c0, 0x8fa808)
/usr/lib/go/src/pkg/runtime/panic.c:266 +0xb6
naquad.me/client.(*Response).Process(0xc210061280)
/home/naquad/projects/prices/go/src/naquad.me/client/client.go:36 +0x2c
naquad.me/client.downloader(0xc210037120, 0xc2100370c0)
/home/naquad/projects/prices/go/src/naquad.me/client/client.go:93 +0x1e4
'timestamp' => date("y.m.d H:i:s"),
'title_1a' => htmlentities(stripslashes($_POST['input-1a-title']), ENT_QUOTES, "UTF-8"),
'firstname_1a' => htmlentities(stripslashes($_POST['input-1a-firstname']), ENT_QUOTES, "UTF-8"),
'middlename_1a' => htmlentities(stripslashes($_POST['input-1a-middlename']), ENT_QUOTES, "UTF-8"),
'lastname_1a' => htmlentities(stripslashes($_POST['input-1a-lastname']), ENT_QUOTES, "UTF-8"),
'primary_phone_type_1a' => htmlentities(stripslashes($_POST['input-1a-phone-type']), ENT_QUOTES, "UTF-8"),
'primary_phone_number_1a' => htmlentities(stripslashes($_POST['input-1a-phone-number-1']), ENT_QUOTES, "UTF-8") . '-' . htmlentities(stripslashes($_POST['input-1a-phone-number-2']), ENT_QUOTES, "UTF-8") . '-' . htmlentities(stripslashes($_POST['input-1a-phone-number-3']), ENT_QUOTES, "UTF-8"),
'primary_phone_number_1a_ext' => htmlentities(stripslashes($_POST['input-1a-phone-number-ext']), ENT_QUOTES, "UTF-8"),
'secondary_phone_type_1a' => html
#ifndef __BIT_OPS__
#define __BIT_OPS__
#ifndef _BV
#define _BV(x) (1 << (x))
#endif
/* #!ruby
*
* # generator for bitN macroes
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include <util/delay.h>
// bit twiddling: enable_bit(s), disable_bit(s), toggle_bit(s), set_bit(s),
// basically wrappers for bitwise operations to make code more readable
#include "bitwit.h"
// USART stuff: initUSART, printString, transmitByte, receiveByte
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <util/delay_basic.h>
#include "macroes.h"
// LCD is wired to PORTB
// higher bits are data bits,
// lower are flags