Skip to content

Instantly share code, notes, and snippets.

@josephspurrier
josephspurrier / values_pointers.go
Last active April 28, 2024 16:41
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@mfojtik
mfojtik / generator.go
Created August 7, 2014 16:35
Simple generator for Golang
package main
import (
"fmt"
"log"
"math/rand"
"regexp"
"strconv"
"strings"
"time"
@perforb
perforb / development.pl
Last active November 4, 2023 13:53
Easily import the settings in Perl.
+{
mysql => {
user => 'volt',
password => 'voltisfast',
},
}
@searbe
searbe / parse_xlsx.php
Created August 7, 2012 09:48
Parse simple XLSX in PHP with SimpleXML and ZipArchive
<?php
/**
* I had to parse an XLSX spreadsheet (which should damn well have been a CSV!)
* but the usual tools were hitting the memory limit pretty quick. I found that
* manually parsing the XML worked pretty well. Note that this, most likely,
* won't work if cells contain anything more than text or a number (so formulas,
* graphs, etc ..., I don't know what'd happen).
*/
#!/usr/bin/env perl
use strict;
use warnings;
use Data::Dumper;
use DBI;
my $data_source = 'dbi:mysql:database=foo;host=localhost;mysql_socket=/var/run/mysql5/mysqld.sock';
my $username = 'bar';
my $auth = '';
my $dbh = DBI->connect($data_source, $username, $auth);
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';