Skip to content

Instantly share code, notes, and snippets.

View jemc's full-sized avatar

Joe Eli McIlvain jemc

  • TheoremOne
  • Cascadia
View GitHub Profile
class MyDecoratorHandler < YARD::Handlers::Ruby::Base
handles method_call(:my_decorator)
# my_decorator {meta:'data'}, def foo(a,b,c); end
def process
args = statement[1]
mdef = args[1]
metadata = args[0].source.gsub /[\r\n]/, ''
# Set build directory to ./build relative to working directory
qbs-config preferences.defaultBuildDirectory build
# Set build directory to /var/builds/@project (absolute)
qbs-config preferences.defaultBuildDirectory /var/builds/@project
import QtQuick 2.1
Item {
id: root
Item {
id: a
property var prop: console.log("a.prop property defined")
@jemc
jemc / Dockerfile
Last active August 29, 2015 14:04
Rubinius Dockerfile
FROM buildpack-deps
# Make a user, group, and home folder
RUN useradd user -g users -d /home/user -m
# Install build and test dependencies for rubinius.
# The ruby installed here is only for building and will be purged later.
RUN apt-get update && apt-get install -y llvm clang ruby ruby-dev bison procps libedit-dev
RUN gem install bundler --no-document
def load
@block_environment || (
@compiled_code || (
@generator || (
@ast || (
@string || (
make_string )
make_ast )
make_generator )
make_compiled_code )
@jemc
jemc / my_library_function.c
Last active August 29, 2015 14:09
Shell bindings for C functions - an example
#include <my_library.h>
int
main (int argc, char *argv[])
{
// Capture stdout file descriptor and position
int orig_stdout_fd;
fpos_t orig_stdout_pos;
fflush (stdout);

Start weechat if you haven't already:

$ weechat

open up browser and go to: https://irc.gitter.im/ retrieve your /PASS

In weecaht run (thanks to raine):

require 'ffi'
require 'benchmark'
module LibC
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :malloc, [:size_t], :pointer
attach_function :free, [:pointer], :void
end
@jemc
jemc / hg.ex
Created March 9, 2015 06:04
elixir mix hg deps
defmodule Mix.SCM.Mercurial do
@behaviour Mix.SCM
@moduledoc false
def fetchable? do
true
end
def format(opts) do
opts[:hg]