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
def timesince(d, now=Time.now) | |
delta = (now - d.to_time).to_i | |
return '0 Minuten' if delta <= 60 | |
chunks = [ | |
[60 * 60 * 24 * 356, 'Jahr', 'Jahre'], | |
[60 * 60 * 24 * 30, 'Monat', 'Monate'], | |
[60 * 60 * 24 * 7, 'Woche', 'Wochen'], | |
[60 * 60 * 24, 'Tag', 'Tage'], | |
[60 * 60, 'Stunde', 'Stunden'], |
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
# Fixes encoding issue by defaulting to UTF-8 | |
def force_encoding(data, encoding = 'UTF-8') | |
if data.respond_to? :force_encoding | |
data.force_encoding encoding | |
elsif data.respond_to? :each_value | |
data.each_value { |v| v.force_encoding(encoding) } | |
elsif data.respond_to? :each | |
data.each { |v| v.force_encoding(encoding) } | |
end | |
data |
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
gem list | cut -d" " -f1 | xargs gem uninstall -aIx |
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
./configure \ | |
--host="arm-apple-darwin" \ | |
--enable-static \ | |
--disable-shared \ | |
--disable-dependency-tracking \ | |
CC=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \ | |
CPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \ | |
CXXCPP=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \ | |
CXX=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc\ | |
AR=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar \ |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |
<xsl:template name="next-day-date"> | |
<xsl:param name="date"/> <!-- format is YYYY-MM-DD --> | |
<xsl:param name="old_year" select="number(substring($date, 1, 4))"/> | |
<xsl:param name="old_month" select="number(substring($date, 6, 2))"/> | |
<xsl:param name="old_day" select="number(substring($date, 9, 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
mysql -Nse 'SHOW TABLES' [database] | while read table; do mysql -e "DROP TABLE $table;" [database]; done |
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
mysql -Nse 'SHOW TABLES' [database] | while read table; do mysql -e "TRUNCATE TABLE $table;" [database]; done |
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
package solr | |
import ( | |
"encoding/xml" | |
) | |
type SolrResponse struct { | |
Results SolrResults `xml:"result"` | |
} |
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
mogrify -filter spline -adaptive-resize 1600x -unsharp 0x1 *.JPG | |
mogrify -filter spline -resize 616x -unsharp 0x1 -path thumbs *.JPG | |
for files in *.JPG | |
do | |
mv "$files" "${files%.JPG}.jpg" | |
done |
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
- (void)removeOldDatabase | |
{ | |
if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"parku-3.0.0"] boolValue]) { | |
NSURL *storeURL = [NSPersistentStore MR_defaultLocalStoreUrl]; | |
NSError *error; | |
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error]; | |
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"parku-3.0.0"]; | |
} | |
} |
OlderNewer