Skip to content

Instantly share code, notes, and snippets.

View carhartl's full-sized avatar

Klaus Hartl carhartl

View GitHub Profile
@carhartl
carhartl / Guardfile
Created February 5, 2011 19:28
Cucumber + Spork + Guard
guard 'cucumber', :profile => 'guard' do
watch(%r{features/.+\.feature})
watch(%r{features/support/.+}) { 'features' }
watch(%r{features/step_definitions/.+}) { 'features' }
end
@carhartl
carhartl / gist:1389213
Created November 23, 2011 17:00
Make Zepto XHR play nicely with Rails XSS protection
$.ajaxSettings.headers || ($.ajaxSettings.headers = {});
$.ajaxSettings.headers['X-CSRF-TOKEN'] = $("meta[name='csrf-token']").attr('content');
@carhartl
carhartl / .irbrc
Created June 13, 2012 16:21
.irbrc
require 'hirb'
Hirb.enable
def me
User.find 1
end
@carhartl
carhartl / CoffeeScript.coffee
Created September 15, 2012 18:23
Why I am not using CoffeeScript
('foo' in {})
@carhartl
carhartl / cookie.js
Created March 2, 2013 19:16
requirejs with jquery.cookie
<script>
var foo = { bar: "baz", };
alert("I'm ok with that.");
</script>
# blog post: http://blog.slashpoundbang.com/post/12938588984/remove-all-accents-and-diacritics-from-string-in-ruby
# coding: utf-8
string.tr(
"ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž",
"AAAAAAaaaaaaAaAaAaCcCcCcCcCcDdDdDdEEEEeeeeEeEeEeEeEeGgGgGgGgHhHhIIIIiiiiIiIiIiIiIiJjKkkLlLlLlLlLlNnNnNnNnnNnOOOOOOooooooOoOoOoRrRrRrSsSsSsSssTtTtTtUUUUuuuuUuUuUuUuUuUuWwYyyYyYZzZzZz")
diff --git a/ext/dl/extconf.rb b/ext/dl/extconf.rb
index 8317ac3..f1b3155 100644
--- a/ext/dl/extconf.rb
+++ b/ext/dl/extconf.rb
@@ -1,7 +1,9 @@
require 'mkmf'
if RbConfig::CONFIG['GCC'] == 'yes'
- $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
+ # $CFLAGS << " -fno-defer-pop -fno-omit-frame-pointer"
@carhartl
carhartl / gist:254f6ffa42b5e19d80bb
Last active August 29, 2015 14:18
rubocop-emoji.rb
# rubocop app.rb --require "./emoji_formatter" --format EmojiFormatter
require "rubocop"
# This formatter display green hearts for files with no offenses and
# letters for files with problems in the them. In the end it
# appends the regular report data in the clang style format.
class EmojiFormatter < RuboCop::Formatter::ProgressFormatter
def report_file_as_mark(offenses)
mark = if offenses.empty?
"\u{1f49a}"
@carhartl
carhartl / .rubocop.yml
Last active August 29, 2015 14:19
Rubocop with Gemfile
AllCops:
Include:
- 'config.ru'