Skip to content

Instantly share code, notes, and snippets.

View EmmanuelDemey's full-sized avatar

Emmanuel DEMEY EmmanuelDemey

View GitHub Profile
@EmmanuelDemey
EmmanuelDemey / gist:5220070
Created March 22, 2013 09:38
How to Create a new StringInterpolator in Scala
implicit class formatHours(val sc: StringContext) {
def fh(args: Any*): String = sc.s(args.map(m => "%02d".format(m)): _*)
}
override lazy val toString = fh"$hours:$minutes"
@EmmanuelDemey
EmmanuelDemey / Page.java
Created June 10, 2013 09:06
How to execute the reveal widget in an element contained by an updated Tapestry zone
@Import(library = {"${assets.path}/mixins/reveal/jquery.reveal.js",},
stylesheet={"${assets.path}/mixins/reveal/reveal.css"})
public class Reveal {
@InjectComponent
private org.apache.tapestry5.corelib.components.Zone zzzone;
@Inject
private AjaxResponseRenderer ajaxResponseRenderer;
@EmmanuelDemey
EmmanuelDemey / validator.js
Created June 10, 2013 15:00
If you want to add a client-side part of a JSR303 validation with Tapestry5-jQuery, everything is the same as this documentation page : http://tapestry.apache.org/bean-validation.html, except the syntax :
$.extend(Tapestry.Validator,{
notnull : function(field, message) {
Tapestry.Validator.required(field, message);
}
});
@EmmanuelDemey
EmmanuelDemey / Index.html
Created July 24, 2013 16:00
How to change, in Angular, the Interpolation symbols {{ }}
<div ng-app="App" ng-controller="Controller">
//label//
</div>
public static void contributeJavaScriptStackSource(
MappedConfiguration<String, JavaScriptStack> configuration) {
configuration.addInstance("newJQueryStack", JQueryStack .class);
}
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>maven-android-plugin</artifactId>
<version>3.9.0-SNAPSHOT</version>
<configuration>
<devices>
<device>127.0.0.1:5555</device>
</devices>
<ips>
<ip>127.0.0.1:5555</ip>
private MainActivity activity;
@Before
public void setup() {
activity = Robolectric.buildActivity(MainActivity.class).get();
}
@Test
public void shouldProduceGreetingWhenButtonPressed() {
TextView textView = (TextView) activity.findViewById(R.id.textView);
var ZIBASE = "xxxxxxxxx";
var TOKEN = "xxxxxxx";
var action = "rowzibasecommand";
function runScenario () {
//Run the scénario 3
var param1 = "1";
var param2 = "3";
var param3 = "";
@EmmanuelDemey
EmmanuelDemey / autocleanup
Created August 10, 2014 16:57
Move to trash read email labelledd, or sub-labelled, by a specific string. (in this case Geeks).
function processLabel(label) {
var data = GmailApp.getUserLabelByName(label).getThreads();
for (var i=0; i < data.length; i++) {
if(!data[i].isUnread() && !data[i].hasStarredMessages()){
data[i].moveToTrash();
}
}
};
function deleteOldMessages(){