Skip to content

Instantly share code, notes, and snippets.

View weirdpercent's full-sized avatar

Drew Prentice weirdpercent

View GitHub Profile
@weirdpercent
weirdpercent / radium-build-error
Created March 7, 2015 12:35
Building Radium on Ubuntu 14
BUILDTYPE=RELEASE
if [ RELEASE = DEBUG ] ; then echo "-DDEBUG -Werror -Wall -g" >buildtype.opt ; else echo "-DRELEASE -DDEBUG -Wall -g -O3" >buildtype.opt ; fi
cd bin && /home/drew/.pyenv/shims/python2 generate_keyboard_sub_ids.py >../common/keyboard_sub_ids.h
bash check_dependencies.sh `./find_python_path.sh` moc uic test_build
g++ -mfpmath=sse -msse2 -c embedded_scheme/scheme.cpp -c `cat buildtype.opt` -Ibin/packages/gc-7.2/include -IQt/ -I/home/drew/.pyenv/versions/2.7.7/include/python2.7 -DNOPAUSEPLAY -DCOMPILING_RADIUM -DGUIISQT -DUSE_GFX_OP_QUEUE -DFULL_VERSION=1 -DIS_LITTLE_ENDIAN=1 -DUSE_OPENGL=1 -DUSE_QT_VISUAL=1 -DUSE_GTK_VISUAL=0 -DUSE_QT_REQTYPE=1 -DUSE_GTK_REQTYPE=0 -DUSE_QT_MENU=1 -DUSE_GTK_MENU=0 -Imidi/rtmidi -ansi -pedantic -Wall -O2 -Werror=array-bounds -msse2 -DFOR_LINUX -DWITH_PD -Wno-unused-function -DUSE_VESTIGE=1 -Wno-unused-function -DUSE_QT4 -DUSE_QIMAGE_BUFFER=1 `pkg-config --cflags Qt3Support --cflags QtOpenGL` -Ibin/packages/qhttpserver-master/src -DQHTTPSERVER_EXPORT -Ibin/pack
@weirdpercent
weirdpercent / gist:566d99252d055be1c266
Created October 31, 2014 18:41
Error while updating rubysl-openssl
/home/drew/.rvm/rubies/rbx-2.2.10/bin/rbx -r ./siteconf20141031-15160-1nk49ke.rb extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
checking for openssl/ssl.h... yes
checking for openssl/conf_api.h... yes
checking for SSL_library_init() in openssl/ssl.h with -Werror=deprecated-declarations... yes
checking for openssl/ssl.h... yes
checking for ERR_peek_last_error()... yes
checking for ASN1_put_eoc()... yes
root_path = File.join(File.dirname(__FILE__), "../")
$LOAD_PATH.unshift(root_path)
require 'lib/peas'
@api = API.new
include GLI::App
reset # Used when this file is repetitively loaded by rspec
@weirdpercent
weirdpercent / search.rb
Created April 16, 2014 23:02
Using open-uri to fetch URLs with error-handling.
require 'multi_json'
require 'open-uri/cached'
def search(url, result)
OpenURI::Cache.cache_path = 'tmp/open-uri'
uri=URI.parse(url)
status=uri.open.meta[:status]
if status[0] == "200"
result=MultiJson.load(uri.open.read)
else
puts "HTTP Status #{status[0]} #{status[1]}"
["YARVInstructionSequence/SimpleDataFormat",
2,
1,
1,
{:arg_size=>0, :local_size=>3, :stack_max=>2},
"<main>",
"./example.rb",
"/home/someone/example.rb",
1,
:top,
@weirdpercent
weirdpercent / rdoc2md.rb
Created March 11, 2014 16:45
Convert rdoc to markdown
require 'rdoc'
h = RDoc::Markup::ToMarkdown.new
puts h.convert(input_string)

Project

Description: What does this project do and who does it serve?

Project Setup

How do I, as a developer, start working on the project?

  1. What dependencies does it have (where are they expressed) and how do I install them?
  2. How can I see the project working before I change anything?

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

# Runs with Picky 3.3.1.
#
# Note: You need some example html files in
# the same directory.
#
# Index data and start:
# 1. rake index
# 2. ruby app.rb
#
# Then, search on it using:
@weirdpercent
weirdpercent / addjson.rake
Last active December 24, 2015 17:19
This rake task is part of the kvr-tools project. It parses product entries in JSON format into Active Record.
desc "Add product entries to database"
task :addjson => :environment do
require 'multi_json'
print 'Adding products to database'
fa=[]
Dir.glob('json/*.json').select {|f| fa.push f}
pa={}
x=0
y=fa.length
y-=1