Skip to content

Instantly share code, notes, and snippets.

View lucianosousa's full-sized avatar
💭
🏊 🚴‍♂️ 🏃- 🏋️‍♂️

Luciano Sousa lucianosousa

💭
🏊 🚴‍♂️ 🏃- 🏋️‍♂️
View GitHub Profile
@lucianosousa
lucianosousa / redis-server
Last active August 29, 2015 14:14 — forked from tahajahangir/redis-server
redis-server - a config file to put on /etc/init.d/redis-server and set as centOS service
#!/bin/sh
#
# redis - this script starts and stops the redis-server daemon
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server
# config: /etc/redis/redis.conf
# config: /etc/sysconfig/redis
# pidfile: /var/run/redis.pid
@lucianosousa
lucianosousa / de.yml
Created October 18, 2012 15:36 — forked from newstler/de.yml
#iOSonRailsConf 2013 web site translations
##############################
##############################
robot_in_the_cloak: "Roboter im Regenmantel"
site_title: "#iOSonRailsConf 2013"
site_description: "Alushta Konferenz für Ruby on Rails und iOS-Entwickler aus aller Welt, die im Frühjahr 2013 stattfinden wird."
site_description_short: "Ruby on Rails und iOS-Entwickler Alushta Konferenz 2013."
site_keywords: "Ruby, Rails, ios, Entwickler, Konferenz, 2013, Web, Handy, iphone, ipad, ipod"
def wtruncate(text, length)
text = text.encode_utf8
if text.length > length
sum = 0
words_ret = []
words = text.split(' ')
words.each do |word|
sum += word.length + 1
break if sum > length
words_ret << word