Skip to content

Instantly share code, notes, and snippets.

View lucasreal's full-sized avatar

Lucas Ishikawa Real lucasreal

View GitHub Profile
We can't make this file beautiful and searchable because it's too large.
id,flag_tsunami,year,month,day,hour,minute,second,focal_depth,eq_primary,eq_mag_mw,eq_mag_ms,eq_mag_mb,eq_mag_ml,eq_mag_mfa,eq_mag_unk,intensity,country,state,location_name,latitude,longitude,region_code,deaths,deaths_description,missing,missing_description,injuries,injuries_description,damage_millions_dollars,damage_description,houses_destroyed,houses_destroyed_description,houses_damaged,houses_damaged_description,total_deaths,total_deaths_description,total_missing,total_missing_description,total_injuries,total_injuries_description,total_damage_millions_dollars,total_damage_description,total_houses_destroyed,total_houses_destroyed_description,total_houses_damaged,total_houses_damaged_description
338,,1048,,,,,,,,,,,,,,,UK,,UNITED KINGDOM: BRITIAN,52,,120,,3,,,,,,,,,,,,,,,,,,,,,,
771,Tsu,1580,4,6,,,,33,6.2,,,,6.2,,,,UK,,UNITED KINGDOM: DOVER STRAITS,51.019,1.309,120,,2,,,,,,2,,,,,,,,,,,,,,,,
7889,Tsu,1757,7,15,,,,,,,,,,,,,UK,,"UNITED KINGDOM: ENGLAND: ST. MARY, SCILLY ISLANDS",49.92,-6.32,120,,,,,,,,,,,,,,
@lucasreal
lucasreal / addEllipsis
Created August 1, 2012 19:48
Cut the given string but not in the middle of the word.
function addEllipsis($text, $maxChars, $splitter = '...'){ // you could put a splitter
$x = $maxChars;
if($maxChars < strlen($text)){ //check if the string have more characters than the limit.
while($text[$x]!= ' ' && $x > 0 ){ //pass thru the string looking for a space.
$x--;
}
$theReturn = substr($text,0,$x).$splitter; //get the slice of the string and concat the splitter.
}else{ //if the string have no more than the characteres limit
$theReturn = $text;
}