Skip to content

Instantly share code, notes, and snippets.

@thescouser89
thescouser89 / 1.8.7-rbenv.patch
Created December 23, 2013 18:46
rbenv patch to be applied when installing ruby 1.8.7-p375 Patch adapted from https://github.com/sstephenson/ruby-build/wiki#make-error-for-200-p247-and-lower-on-fedorared-hat
--- ext/openssl/ossl_pkey_ec.c
+++ ext/openssl/ossl_pkey_ec.c
@@ -757,8 +757,10 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
method = EC_GFp_mont_method();
} else if (id == s_GFp_nist) {
method = EC_GFp_nist_method();
+#if !defined(OPENSSl_NO_EC2M)
} else if (id == s_GF2m_simple) {
method = EC_GF2m_simple_method();
+#endif
@postmodern
postmodern / rails_rce.rb
Last active July 17, 2023 11:54
Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#!/usr/bin/env ruby
#
# Proof-of-Concept exploit for Rails Remote Code Execution (CVE-2013-0156)
#
# ## Advisory
#
# https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion
#
# ## Caveats
#
@wakiki
wakiki / gist:3312792
Created August 10, 2012 09:12
Rails 3 merging scope with OR
# By Steve Leung
# steve@leungs.me
class ActiveRecord::Relation
# temporarily hack for allowing combining scopes with OR
# doesn't add the join tables so need to use .includes manually
# ie. Jobship.includes(:job).or(Jobship.accepted, Jobship.declined).count
def or(*scopes)
clauses = *scopes.map do |relation|
@icodeforlove
icodeforlove / gist:868532
Created March 13, 2011 23:05
querySelectorAll for anything less than IE8
// IE7 support for querySelectorAll in 226 bytes... It's a little slow but better than a 20kb solution when you need something cross platform and lightweight.
(function(d){d=document,a=d.styleSheets[0]||d.createStyleSheet();d.querySelectorAll=function(e){a.addRule(e,'f:b');for(var l=d.all,b=0,c=[],f=l.length;b<f;b++)l[b].currentStyle.f&&c.push(l[b]);a.removeRule(0);return c}})()
@bluefuton
bluefuton / to_sentence.php
Created November 22, 2010 17:39
Simple implementation of Rails' .to_sentence for PHP
<?php
class ArrayExtensions
{
public function to_sentence($array)
{
$count = count($array);
switch ($count)
{
case 0:
(function(){
function focusInHandler(e){
Event.findElement(e).fire("focus:in");
}
function focusOutHandler(e){
Event.findElement(e).fire("focus:out");
}
if (document.addEventListener){
document.addEventListener("focus", focusInHandler, true);