Skip to content

Instantly share code, notes, and snippets.

View gabrielmansour's full-sized avatar

Gabriel Mansour gabrielmansour

View GitHub Profile
@gabrielmansour
gabrielmansour / gist:8969418
Last active August 29, 2015 13:56
CONVENT CONNIVANCE CONFUDDLES CONSTABLES:
CONVENT CONNIVANCE CONFUDDLES CONSTABLES:
Considering conspicuous conduct concerning constant congregation confessions, Contra-Conformists confident
Conservative congressmen conversion conspiracy continues, constructing contrived convivial consecrations
connecting controversial contretemps. Consequently, consistent concentrated conflict convulses Connecticut;
Confederates' condos condemned.
@gabrielmansour
gabrielmansour / gist:9843631
Created March 28, 2014 21:45
HTML entities escape-once regex
// Does not match against already-encoded HTML entities (e.g. &)
/&(?!(?:[a-z0-9]+|#x?[a-z0-9]{1,4});)/i
def rot13(word)
alphabet = ('a'..'z').to_a
word.downcase.split('').map do |letter|
index = alphabet.index(letter)
if index >= 13
index -= 13
else
index += 13
end
alphabet[index]
@gabrielmansour
gabrielmansour / generator.js
Created July 5, 2014 06:25
Sex T-Rex Cowboy quote generator
// Quote generator for
// http://sextrexcomedy.com/2013/07/23/cowboy-quote-generator/
// Outputs a list of quotes. Choose your favourite and make it an image macro!
function generateQuote(){
for (var $rows=jQuery('table tr'), numrows=$rows.length, phrase=[], i=2;i<=4;i++){
phrase.push( $rows.eq( ~~(Math.random() * numrows) ).find('td:nth-child('+i+')').text().trim() );
}
return phrase.join(' ');
}
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5490~1/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5490)
Last login: Mon Nov 23 13:41:41 on ttys004
nulayer-devs-mac-mini:~ gabriel$ which ruby
/Users/gabriel/.rvm/ruby-1.8.7-p174/bin/ruby
nulayer-devs-mac-mini:~ gabriel$ which gem
/Users/gabriel/.rvm/ruby-1.8.7-p174/bin/gem
nulayer-devs-mac-mini:~ gabriel$ gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
nulayer-devs-mac-mini:nokogiri gabriel$ cat mkmf.log
nokogiri_find_header: checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/Users/gabriel/.rvm/ruby-1.8.7-p174/include,/Users/gabriel/.rvm/ruby-1.8.7-p174/include/libxml2,/usr/include,/usr/include/libxml2... -------------------- yes
"gcc -E -I. -I/Users/gabriel/.rvm/ruby-1.8.7-p174/lib/ruby/1.8/i686-darwin9.8.0 -I. -I/opt/local/include/ -I/opt/local/include/libxml2 -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -isysroot /Developer/SDKs/MacOSX10.5.sdk -arch x86_64 -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -I/opt/local/include/ conftest.c -o conftest.i"
checked program was:
/* begin */
1: #include <iconv.h>
/* end */
--------------------
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export LC_CTYPE=en_US.UTF-8 # for textmate svn bundle repo
# A "safer" rm; moves file to Trash instead
function trash() {
target="$HOME/.Trash/"
filepath=$(eval echo \$${#}) # trying to get last argument; don't know how to do so without using eval
file=$(basename "$filepath")
- link_to sn[:url] % article_url(@article) do
image_tag sn[:image], :alt => sn[:name], :title => sn[:title]
{ scopeName = 'text.haml';
fileTypes = ( 'haml', 'sass' );
foldingStartMarker = '^\s*([-%#\:\.\w\=].*)\s$';
foldingStopMarker = '^\s*$';
patterns = (
{ contentName = 'string.quoted.double.ruby';
begin = '^\s*==';
end = '$\n?';
patterns = ( { include = '#interpolated_ruby'; } );
},