Skip to content

Instantly share code, notes, and snippets.

View fredcy's full-sized avatar

Fred Yankowski fredcy

View GitHub Profile
@fredcy
fredcy / go-oci8_build
Created November 26, 2013 14:59
This is the output of running "go build -n" in go/src/github.com/mattn/go-oci8
#
# github.com/mattn/go-oci8
#
mkdir -p $WORK/github.com/mattn/go-oci8/_obj/
mkdir -p $WORK/github.com/mattn/
cd /Users/fcy/go/src/github.com/mattn/go-oci8
pkg-config --cflags oci8
pkg-config --libs oci8
/usr/local/go/pkg/tool/darwin_amd64/cgo -objdir $WORK/github.com/mattn/go-oci8/_obj/ -- -I $WORK/github.com/mattn/go-oci8/_obj/ oci8.go
@fredcy
fredcy / cgo_debug_gcc
Created November 26, 2013 15:04
After using "go build -x" to see what commands execute I ran the cgo command manually adding "-debug-gcc=true". Here is the command and its output.
$ /usr/local/go/pkg/tool/darwin_amd64/cgo -debug-gcc=true -objdir $WORK/github.com/mattn/go-oci8/_obj/ -- -Qunused-arguments -I/usr/local/lib/instantclient_11_2/sdk/include -I $WORK/github.com/mattn/go-oci8/_obj/ oci8.go
$ gcc -E -dM -xc -m64 -Qunused-arguments -I/usr/local/lib/instantclient_11_2/sdk/include -I /github.com/mattn/go-oci8/_obj/ - <<EOF
typedef struct { char *p; int n; } _GoString_;
typedef struct { char *p; int n; int c; } _GoBytes_;
_GoString_ GoString(char *p);
_GoString_ GoStringN(char *p, int l);
_GoBytes_ GoBytes(void *p, int n);
char *CString(_GoString_);
#line 3 "oci8.go"
@fredcy
fredcy / Elm problem with default field name.md
Last active November 13, 2015 23:10
Show problem passing 'default' field name though elm port.

This example demonstrates how the default field/property name somehow causes a problem when passing data into an Elm application through a port.

import Html exposing (span)
import Html.Attributes exposing (property)
import Json.Encode exposing (string)
main = span [ property "innerHTML" <| string "x &times; y"] []
#!/bin/bash
SITEHOME=/home/fred/elm/platform/Elm-Platform/master/elm-lang.org
PROG=dist/build/run-elm-website/run-elm-website
NAME=elm-website
PATH=/usr/local/bin:/home/fred/.cabal/bin:$PATH
LOGFILE=/var/log/${NAME}.log
# need this to avoid error about "hGetContents: invalid argument
@fredcy
fredcy / date-display.elm
Created December 8, 2015 17:25
Show how Elm displays time and date values as strings
import Date
import Effects
import Html exposing (li, text, ul)
import StartApp
import Time
app =
StartApp.start
{ init = (0, Effects.none)
, inputs = [Time.every Time.second]
@fredcy
fredcy / elm-http-get-example.elm
Last active December 10, 2015 20:57
Example using Elm Http.get
import Effects
import Html exposing (..)
import Http
import StartApp
import Task
app : StartApp.App String
app =
StartApp.start
@fredcy
fredcy / elm-window-dimensions.elm
Created December 10, 2015 16:06
Example getting initial window.dimensions value in Elm app using StartApp
import Effects exposing (Effects)
import Html exposing (..)
import StartApp
import Task exposing (Task)
import Window
type alias Model = (Int, Int)
type Action = Update (Int, Int) | NoOp
@fredcy
fredcy / elm-onkeypress.elm
Last active December 17, 2015 20:05
Elm onKeyPress event
import Char
import Html exposing (..)
import Html.Events exposing (..)
import StartApp.Simple as StartApp
import String
main =
StartApp.start { model = model, view = view, update = update }
type alias Model = String
@fredcy
fredcy / selected-problem.elm
Created December 21, 2015 21:10
Elm example of Html.Attributes.selected problem
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import StartApp.Simple as StartApp
options : List (String)
options = [ "one", "two", "three", "four", "five" ]
type alias Model = String
type alias Action = String