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
class TheCompanyProcess { | |
public static String cleanUpNames(List listOfNames) { | |
listOfNames | |
.findAll {it.length() > 1} | |
.collect {it.capitalize()} | |
.join(',') | |
} | |
} |
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
public class TheCompanyProcess { | |
public String cleanNames(List<String> listOfNames) { | |
StringBuilder result = new StringBuilder(); | |
for(int i = 0; i < listOfNames.size(); i++) { | |
if (listOfNames.get(i).length() > 1) { | |
result.append(capitalizeString(listOfNames.get(i))).append(","); | |
} | |
} | |
return result.substring(0, result.length() - 1).toString(); | |
} |
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
val employees = List("neal", "s", "stu", "j", "rich", "bob") | |
val result = employees | |
.filter(_.length() > 1) | |
.map(_.capitalize) | |
.reduce(_ + "," + _) |
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
import org.apache.http.Consts; | |
import org.apache.http.client.methods.CloseableHttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.config.ConnectionConfig; | |
import org.apache.http.conn.HttpConnectionFactory; | |
import org.apache.http.conn.ManagedHttpClientConnection; | |
import org.apache.http.conn.routing.HttpRoute; | |
import org.apache.http.entity.ContentLengthStrategy; | |
import org.apache.http.entity.ContentType; | |
import org.apache.http.entity.StringEntity; |
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
bootbox.dialog("This message goes into modal body!", | |
[ | |
{ | |
"label": "Cancel", | |
"class": "btn-primary", | |
"callback": function () { | |
bootbox.hideAll(); | |
} | |
}, | |
{ |
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
arul:~ arul$ system_profiler -detailLevel mini | grep "Model Identifier:" | |
Model Identifier: MacBookPro8,3 | |
arul:~ arul$ sh | |
sh-3.2$ kextstat | grep IOPlatformPluginFamily | |
84 5 0xffffff7f80dfa000 0xa000 0xa000 com.apple.driver.IOPlatformPluginFamily (5.3.0d51) <9 7 6 5 4 3> | |
sh-3.2$ sudo su - | |
Password: | |
arul:~ root# cd /System/Library/Extensions/IOPlatformPluginFamily.kext/Contents/PlugIns/ACPI_SMC_PlatformPlugin.kext/Contents/Resources/ | |
arul:Resources root# ls | |
MacBook1_1.plist MacBookAir2_1.plist MacBookPro3_1.plist MacBookPro7_1.plist Macmini3_1.plist iMac11_3.plist |
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
// Print the names of albums that have at least one track rated four or higher, sorted by name. | |
albums.stream() | |
.filter(a -> a.tracks.stream().anyMatch(t -> (t.rating >= 4))) | |
.sorted(comparing((Album album) -> album.name)) | |
.forEach(album -> System.out.println(album.name)); | |
// Merge tracks from all albums | |
List<Track> allTracks = albums.stream() | |
.flatMap((Album album) -> album.tracks.stream()) | |
.collect(toList()); |
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
students.parallelStream().forEach(student -> { | |
student.GradePointAverage = student.Tests.parallelStream().mapToDouble(test -> test.Grade * test.Weight).sum(); | |
}); |
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
#!/bin/bash | |
# This script is edited by Brice Dutheil. | |
# See there in french http://blog.arkey.fr/2012/07/30/script-pour-installer-le-jdk-5-sur-macosx-lion/ | |
# Translate button is broken for now, please use Google to translate this website. | |
# 2013/06/10 Tested on Mountain Lion 10.8.4 | |
# 2013/02/14 Updated to run on Mountain Lion 10.8.2 | |
# | |
# 2012/08/25 This script didn't behave correctly when ran on 10.8.1 | |
# Added recommendation to always run this script after updates such as Java, XCode, OSX, etc. |
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
addresses.parallelStream().forEach(address -> sendMail(address)); |