This file contains hidden or 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
@()( | |
implicit | |
params:play.mvc.Scope.Params, | |
flash:play.mvc.Scope.Flash, | |
errors:Map[String,play.data.validation.Error] | |
) | |
@import play.i18n.Messages | |
@main(title = "Test title") { | |
<p>Hello world in &{'english'}</p> | |
} |
This file contains hidden or 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
@Override | |
public void get(final Object obj) { | |
List<Object> res = null; | |
try { | |
Class<?> clazz = obj.getClass(); | |
ClassInfo info = ClassInfo.getClassInfo(clazz); | |
final String[] fields = new String[info.updateFields.size()]; | |
for (int i = 0; i < info.updateFields.size(); i++) { |
This file contains hidden or 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 static List<User> findByLocation(Long South_Lat, Long South_Lng, Long North_Lat, Long North_Lng) { | |
List<User> users = all().filter("latitude<", South_Lat).filter("latitude>", North_Lat).filter("latitude>", North_Lat).filter("longitude>", North_Lng).fetch(); | |
return users; | |
} |
This file contains hidden or 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
Calendar cal = new GregorianCalendar(); | |
cal.setTime(new Date()); | |
cal.add(Calendar.DAY_OF_YEAR,-1); | |
Date oneDayBefore= cal.getTime(); | |
List<User> users = all().filter("lastSeen>", oneDayBefore).fetch(); |
This file contains hidden or 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 controllers | |
import java.io.StringReader | |
import javax.xml.parsers.DocumentBuilder | |
import javax.xml.parsers.DocumentBuilderFactory | |
import models.Contact | |
import org.w3c.dom.Document | |
import org.xml.sax.InputSource | |
import play.cache.Cache | |
import play.libs.OAuth |
This file contains hidden or 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
Map<String, Integer> counter = new HashMap<String, Integer>(); | |
for (Item item : aa) { | |
counter.put(item.name, 1); | |
} |
This file contains hidden or 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
protected static void incrementValue(Map<Long, Integer> counters, Long toAdd) { | |
Integer currValue = counters.get(toAdd); | |
if (currValue == null) | |
counters.put(toAdd, 1); | |
else | |
counters.put(toAdd, currValue+1); | |
} | |
Map<String, Integer> counter = new HashMap<String, Integer>(); |
This file contains hidden or 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 models; | |
import java.lang.annotation.*; | |
import java.lang.reflect.Type; | |
import java.util.List; | |
import com.google.appengine.api.datastore.Blob; | |
import play.data.Upload; | |
import play.data.binding.*; |
This file contains hidden or 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 renderList = { | |
".GsImageBox *" #> page.map(outfit => { | |
".outfit-thumb [href]" #> outfit.url() & | |
".thumb [alt]" #> outfit.toString() & | |
".thumb [src]" #> outfit.thumbUrl() & | |
".views-count *" #> outfit.view | |
}) | |
} |
This file contains hidden or 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
<?php | |
function sendMemcacheCommand($command){ | |
$server = "localhost"; | |
$port = 11211; | |
$s = @fsockopen($server,$port); | |
if (!$s){ | |
die("Cant connect to:".$server.':'.$port); |