Skip to content

Instantly share code, notes, and snippets.

Muescha muescha

View GitHub Profile
@nathancolgate
nathancolgate / Gemfile
Last active Nov 30, 2019
How I built a rails interface on top of the amazing IceCube ruby gem. Video of final product: http://youtu.be/F6t-USuWPag
View Gemfile
# Add these two gems
gem 'ice_cube', '0.9.3'
gem 'squeel', '1.0.16'
@dainkaplan
dainkaplan / Ansi.java
Last active May 16, 2020
Simple ANSI colors class for terminal code for JVM written in Scala and Java (two implementations)
View Ansi.java
package org.tempura.console.util;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Usage:
* <li>String msg = Ansi.Red.and(Ansi.BgYellow).format("Hello %s", name)</li>
* <li>String msg = Ansi.Blink.colorize("BOOM!")</li>
@MicahChalmer
MicahChalmer / .htaccess
Last active May 1, 2016
Scripts to set up Ruby 1.9.3 on a DreamHost shared hosting account via rbenv and ruby-build, and run a Rack app with it via FastCGI.
View .htaccess
<IfModule mod_fastcgi.c>
AddHandler fastcgi-script .fcgi
</IfModule>
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
</IfModule>
Options +FollowSymLinks +ExecCGI
RewriteEngine On
@dnshl
dnshl / Rakefile
Created Nov 21, 2012
Rake Task with XMLFormatter for cucumber and XSLT Document
View Rakefile
require 'gherkin/parser/parser'
require 'gherkin/formatter/json_formatter'
require 'stringio'
require "active_support/core_ext/hash/conversions"
require 'nokogiri'
class XMLFormatter < Gherkin::Formatter::JSONFormatter
def done
@io.write(@feature_hashes.to_xml)
end
@niloc132
niloc132 / Sample.gwt.xml
Created Oct 17, 2012
Make more premutations for both small builds and bigger builds with full stack traces. Just add debug=true to the querystring of app's url, reproduce the issue, and read the trace!
View Sample.gwt.xml
<set-property name="compiler.emulatedStack" value="true, false" />
<property-provider name="compiler.emulatedStack">
<![CDATA[return (location.search.indexOf("debug=true") != -1) ? "true" : "false";]]>
</property-provider>
<set-configuration-property name="compiler.emulatedStack.recordFileNames" value="true" />
<set-configuration-property name="compiler.emulatedStack.recordLineNumbers" value="true" />
View gist:3832504
#!/usr/bin/env ruby
def get_values(string, expression)
regex = Regexp.new(expression.gsub(/\{([^\}]+)\}/) { "(?<#{$1}>\\S+)" })
(match = regex.match(string)) ? Hash[match.names.zip(match.captures)] : {}
end
p get_values "Alice is 23 years old", "{name} is {age} years old" #=> {"name"=>"Alice", "age"=>"23"}
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@david-mark
david-mark / gist:3279190
Created Aug 6, 2012
Sencha Touch Still Sucks
View gist:3279190

Was asked to look at this thing again; only reviewed the JS portion. Last I checked, the CSS was similarly reality-challenged. Graphics are nice, but are tantamount to the paint job on a used car. Under the hood, this thing is all junk. It's hard to imagine the innards of any Web or mobile device-based application would end up like this, which raises the question of whether the authors have ever written such applications (or any amount of meaningful JS).

/**
 * @class Ext
 * @singleton

There (still) are no "classes" or "singletons" in JS (starting off on the wrong foot by mangling JS terms).

@seanlilmateus
seanlilmateus / gist:3187192
Last active Sep 2, 2016
How to use Obj-C with MacRuby/Rubymotion
View gist:3187192

Using Obj-C with MacRuby/Rubymotion

This little post aims to help you to translate Objective-C Blocks into Ruby blocks. Let's start by taking a look at few examples of iOS API call where blocks are used for animations and enumeration

Ruby Lambda Syntaxes:

Im Rubymotion and MacRuby you can use all the Ruby Lambda syntaxes that are:

block = lambda { |param|  ... }
@ParkinT
ParkinT / Rakefile
Last active Oct 7, 2015
RubyMotion Rakefile - improved workflow
View Rakefile
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project'
# custom rake tasks
require '../raketasks/gemerator.rb'
desc "Open latest crash log"
task :log do
app = Motion::Project::App.config
You can’t perform that action at this time.