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
import org.restlet.Context; | |
import org.restlet.ext.jaxrs.JaxRsApplication; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import javax.ws.rs.core.Application; | |
import java.util.HashSet; | |
import java.util.Set; | |
public class WebServicesApplication extends JaxRsApplication |
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 class SpringRestletServlet extends ServerServlet | |
{ | |
private static final long serialVersionUID = 3178425324679869158L; | |
private static final Logger LOG = LoggerFactory.getLogger( SpringRestletServlet.class ); | |
/** | |
* Override the createApplication method to inject Spring objects | |
* | |
* @param context - Restlet context |
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
{% for post in site.posts limit:5 %} | |
<div class="box"> | |
<h3>{{post.title}}</h3> | |
<div class="clearfix"></div> | |
<div class="right big"> | |
{% assign breakIndex = -1 %} | |
{% for element in post.content %} | |
{% if element contains '<!--more-->' %} | |
{% assign breakIndex = forloop.index %} | |
{% endif %} |
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
EmailTemplater.templatesController = SC.ObjectController.create({ | |
content: SC.Object.create({ | |
subject: '', | |
body: '' | |
}), | |
convertedSubject: function() { | |
return this._replacePlacholders("subject"); | |
}.property('subject'), |
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
matygo/ | |
└── src | |
├── main | |
│ └── scala | |
│ └── com | |
│ └── matygo | |
│ └── matygoApp | |
│ ├── service | |
│ │ └── services | |
│ │ └── emailTemplates |
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
art-macbook:matygo artg$ time curl -v localhost:8081/courses -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d '{"title":"a","description":"2","subject":"","organizationId":1}' -b cookies.txt | |
* About to connect() to localhost port 8081 (#0) | |
* Trying ::1... connected | |
* Connected to localhost (::1) port 8081 (#0) | |
> POST /courses HTTP/1.1 | |
> User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5 | |
> Host: localhost:8081 | |
> Cookie: MatygoSession=Oixh2Gnrj6E95L497o9ZMw00A6DDMK0YjXCxCSv6RubXQw6SGTV0BYibww4cEmzh | |
> Content-Type: application/json | |
> Accept: application/json |
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
"be marked completed as done with concurrent requests" in { | |
var q1, q2 = new FreeFormQuestion() | |
inTransaction { | |
q1 = FreeFormQuestionDao.saveOrUpdate(new FreeFormQuestion("is this the real life?", middle.id)) | |
q2 = FreeFormQuestionDao.saveOrUpdate(new FreeFormQuestion("is this just fantasy?", middle.id)) | |
} | |
val system = ActorSystem("testSystem") | |
val sarActor = system.actorOf(Props(new Actor { | |
protected def receive = { |
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
actions resource ("courses") policies( | |
~:[OrganizationAdminPolicy] -> ~:[BadAuthorizationResponder] only ("create", "update", "delete"), | |
~:[OrganizationUserPolicy] -> ~:[BadAuthorizationResponder] only ("show", "index") | |
) | |
actions resource ("concepts") policies ( | |
~:[CourseAdminPolicy] -> ~:[BadAuthorizationResponder] only ("create", "delete"), | |
~:[CourseInstructorPolicy] -> ~:[BadAuthorizationResponder] only ("update"), | |
~:[CourseStudentPolicy] -> ~:[BadAuthorizationResponder] only ("show", "index") | |
) |
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
import scala.collection.parallel.immutable.ParRange | |
object Parallel extends App { | |
val bigSet = 1 to 500 | |
val start = System.currentTimeMillis() | |
bigSet.foreach { i => | |
Thread.sleep(200) | |
if (i % 100 == 0) print(".") | |
} |
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
about | |
abuse | |
acme | |
ad | |
admanager | |
admin | |
ads | |
adsense | |
adult | |
adwords |
OlderNewer