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
app.filter "truncateText", -> | |
(string, maxLength, wordsafe = false, addEllipsis = false, minWordsafeLength = 1) -> | |
ellipsis = '' | |
maxLength = Math.max(maxLength, 0) | |
minWordsafeLength = Math.max(minWordsafeLength, 0) | |
# Remove HTML tags | |
string = string.replace(/<(?:.|\n)*?>/gm, '') | |
# No truncation needed, so don't add ellipsis, just return. |
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
# Directly copied from eycap-0.5.2 (thanks!) | |
# | |
# With these tasks you can: | |
# - dump your production database and save it in shared_path/db_backups | |
# - dump your production into your local database (clone_to_local) | |
# | |
# Tested and fixed by fjguzman | |
Capistrano::Configuration.instance(:must_exist).load do | |
namespace :db do |
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 perl | |
# Quick and dirty way of adding a prefix to all tables | |
# in a sql file | |
# | |
# Takes a sql file, duplicates it, and adds whatever | |
# prefix you pass to all TABLE and INSERT statements | |
# in the copied file. | |
# | |
# Usage: ./dbp.pl example.sql prefix |
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 | |
# Answer to part 1 of the Greplin Programming Challenge (http://challenge.greplin.com/) | |
text = "FourscoreandsevenyearsagoourfthersbroughtforthonthiscontainentanewnationconceivedinzLibertyanddedicatedtothepropositionthatallmenarecreatedequalNowweareengagedinagreahtcivilwartestingwhetherthatnaptionoranynartionsoconceivedandsodedicatedcanlongendureWeareqmetonagreatbattlefiemldoftzhatwarWehavecometodedicpateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthatnationmightliveItisaltogetherfangandproperthatweshoulddothisButinalargersensewecannotdedicatewecannotconsecratewecannothallowthisgroundThebravelmenlivinganddeadwhostruggledherehaveconsecrateditfaraboveourpoorponwertoaddordetractTgheworldadswfilllittlenotlenorlongrememberwhatwesayherebutitcanneverforgetwhattheydidhereItisforusthelivingrathertobededicatedheretotheulnfinishedworkwhichtheywhofoughtherehavethusfarsonoblyadvancedItisratherforustobeherededicatedtothegreattdafskremainingbeforeusthatfromthesehonoreddeadwet |
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 will search your config/deploy folder for *.rb files | |
# and add the basename without the extension to :stages. | |
# | |
# Now you don't need something like "set :stages, %w(dev prod stage)" | |
set(:stages) do | |
Dir[File.join('config', 'deploy') + '/*.rb'].map do |f| | |
f.match(/[^\/]+?(?=\.[^\/]+$)/)[0] | |
end | |
end |
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
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
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
require 'rubygems' | |
require 'drupal-deploy' | |
load File.join(File.dirname(__FILE__), 'config', 'lib', 'deploy') | |
# The name of your Drupal site | |
set :application, "sandbox" | |
# The user that will own the files directory | |
set :web_user, "apache" |
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
# Check for drush on your remote server(s) | |
depend :remote, :command, "drush" | |
# A couple of custom tasks I use to fix some things. You may add or modify | |
# anything in this file. | |
before 'deploy:symlink', 'drupal:symlink:webapp' | |
after 'deploy:symlink', 'drupal:configure:settings' | |
after 'deploy:rollback', 'drupal:symlink:webapp' | |
namespace :drupal do |
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 | |
# dds.rb -- DrupalCon Denver Schedule | |
# Create a printer friendly schedule of your DrupalCon Denver sessions | |
# Usage: ./dds.rb YOURID | |
# For example: ./dds.rb 34143 | |
require 'nokogiri' | |
require 'open-uri' | |
user_id = ARGV[0] |
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 perl | |
# Feed this script an android_report csv file. | |
# Note: Requires Text::CSV_XS | |
use strict; | |
use warnings; | |
use Text::CSV_XS; | |
use File::Basename; |
OlderNewer