Skip to content

Instantly share code, notes, and snippets.

View unixmonkey's full-sized avatar

David Jones unixmonkey

View GitHub Profile
@unixmonkey
unixmonkey / Library Logs Hombrew qt 02.make
Last active August 29, 2015 14:02
Homebrew: qt failed to build on 10.10
cd src/tools/bootstrap/ && /Applications/Xcode.app/Contents/Developer/usr/bin/make -f Makefile
cd src/3rdparty/webkit/Source/ && /private/tmp/qt-4sJT/qt-everywhere-opensource-src-4.8.6/bin/qmake /private/tmp/qt-4sJT/qt-everywhere-opensource-src-4.8.6/src/3rdparty/webkit/Source/WebKit.pro -spec ../../../../mkspecs/unsupported/macx-clang-libc++ -o Makefile.WebKit
clang -c -pipe -O2 -arch x86_64 -Wall -W -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/unsupported/macx-clang-libc++ -I. -I../../../include -I../../../include/QtCore -I../../../include/QtXml ../../corelib/tools/qlocale_mac.mm -o .obj/release-shared/qlocale_mac.o
clang++ -c -pipe -stdlib=libc++ -mmacosx-version-min=10.7 -O2 -fPIC -arch x86_64
@unixmonkey
unixmonkey / anagram.rb
Last active December 28, 2015 06:48
Indy.rb code review exercises 2013-11-13
class Anagram
def initialize(target)
@target = target.downcase
end
def match(word_list)
word_list.select do |word|
is_anagram?(word.downcase)
end
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
def problem_4(i);(((i.count('G')+i.count('C')).to_f/i.size)*100).round 4;end
(0..s.size).map{|i|r=s.index(t,i);r+1 if r}.uniq.join' '
def problem_2(a,b);(0..a.size).select{|i|a[i]!=b[i]}.size;end
def problem1(i)
%w(A C G T).map{|l|i.split('').select{|b|b==l}.size}.join ' '
end
@unixmonkey
unixmonkey / join_html_output.rb
Last active December 18, 2015 21:59
Rack middleware to take all of the server output and condense it down to a single line of html source.
module Rack
class JoinHtmlOutput
def initialize(app)
@app = app
end
def call(env)
# get the original repsonse
status, headers, response = @app.call(env)
@unixmonkey
unixmonkey / OSX10.8 Mountain Lion Web Developer Setup Instructions
Last active March 3, 2018 19:25
My Personal Setup Instructions from fresh OSX1.8 (Mountain Lion) install:
My Personal Setup Instructions from fresh OSX1.8 (Mountain Lion) install:
Some notes on why I have chosen some of these preferences:
I am primarlily a Ruby web developer, and work on a variety of Ruby and Rails versions and database platforms.
I usually use RVM (http://rvm.beginrescueend.com), but this guide uses [chruby](https://github.com/postmodern/chruby)
I spend most of my day in the Terminal, Atom editor, and a Web Browser, and desire to keep things as simple and stock as possible, but do have certain minor preferences that make my day-to-day interaction with the computer better.
Choose Full-Disk encryption on Install and set a password
Run software update until it cannot find any updates
# This script is intended to check if a Rails app is potentially vulnerable
# to CVE-2013-0156. There is no publicly known exploit for Rails on Ruby 1.8,
# but it is entirely possible due to the serializing of yaml objects
#
# By running this against an unpatched application, the log should indicate
# a timestamp being sent as params[:exploit] like so:
# Parameters: {"exploit"=>Thu Jan 01 00:00:00 +0000 1970, "action"=>"new", "controller"=>"sessions"}
# against a patched server, the exploit key will be missing entirely
#
# Besides upgrading to one of the patched versions of Rails, the following