This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# frozen_string_literal: true | |
# Via https://gist.github.com/ta1kt0me/6a7058d16621785d4f7038bde6cd3b98 | |
module RailsGeneratorFrozenStringLiteralPrepend | |
RUBY_EXTENSIONS = %w[.rb .rake].freeze | |
def render | |
return super unless RUBY_EXTENSIONS.include?(File.extname(destination)) | |
"# frozen_string_literal: true\n\n#{super}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: UTF-8 | |
# | |
# $ rake checkout new_branch_name | |
# | |
# Via https://gist.github.com/jonlemmon/4076864 | |
# | |
# 1. Roll back any migrations on your current branch which do not exist on the | |
# other branch | |
# 2. Discard any changes to the db/schema.rb file | |
# 3. Check out the other branch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Sunnytize | |
Plugin URI: | |
Description: A better file name sanitizer | |
Version: 2.0 | |
Author: Sunny Ripert, Bastien Maillard, Guillaume Morisseau | |
Author URI: http://sunfox.org | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.6 | |
# | |
# Riff, rock, and much more !! | |
# | |
# Copyright 2008 Antoine Millet <antoine@inaps.org> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
✈ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
class String | |
def truncate(length = 30, truncate_string = "...") | |
return self if self.length <= length | |
short_length = length - truncate_string.length | |
self[0...short_length] + truncate_string | |
end | |
end | |
def date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The infamous Monkey-Hash. Example: | |
# h = {} | |
# h.foo = "bar" | |
# h.foo # => "bar" | |
class Hash | |
def method_missing(method, *params) | |
key = method.to_s | |
if key =~ /=$/ | |
key = key[0..-2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# irb(main):001:0> h = {} | |
# => {} | |
# irb(main):002:0> h.foo = "bar" | |
# => "bar" | |
# irb(main):003:0> h.foo | |
# => "bar" | |
class Hash | |
def method_missing(method, *params) | |
method_string = method.to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Written by Antoine 'NaPs' Millet | |
# | |
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
# Version 2, December 2004 | |
# | |
# Copyright (C) 2004 Sam Hocevar | |
# 14 rue de Plaisance, 75014 Paris, France | |
# Everyone is permitted to copy and distribute verbatim or modified |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function is-git? { | |
git status &> /dev/null | |
[ $? != 128 ] | |
} | |
function git-init-remote { | |
name=$(basename $PWD).git | |
path=~/repositories/$name | |
if is-git?; then | |
ssh bearnaise.net -t "mkdir $path && cd $path && git --bare init" || |
NewerOlder