Skip to content

Instantly share code, notes, and snippets.

View yesil's full-sized avatar
🍉

Ilyas Türkben yesil

🍉
View GitHub Profile
class Ads {
val formatter = ISODateTimeFormat.dateTime()
var date:DateTime = new DateTime
lazy val mongoColl = MongoConnection()("abc")("ads")
def list = {
val q = MongoDBObject("published" -> MongoDBObject("$lt" -> date))
@yesil
yesil / killbackspace.js
Created December 2, 2011 13:31
kill backspace in browsers(ff 3.6 ok, IE 8 ok)
$(document).keydown(function(e){
return (e.which != 8 || e.target.nodeName =='TEXTAREA' || e.target.nodeName == 'INPUT' && e.target.attributes.type.value == 'text');
});
@yesil
yesil / fbhack.js
Created February 16, 2012 16:25
facebook hack
// après avoir surchargé l'API facebook comme ci-dessous
FB.XFBML._getDomElements = function (a, e, d) {
var c = e + '-' + d;
if(FB.UA.ie())
return document.querySelectorAll('.'+c);
else
return a.getElementsByClassName(c);
};
@yesil
yesil / chrome.xpath.js
Created December 10, 2012 16:34
How to xpath in chrome developer console
var el = document.evaluate("//ul[1][@class='some_class_name']/li[2]/a",document, null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null)
el.snapshotItem()
@yesil
yesil / jenkins-groovy-command-ace-support.js
Created February 26, 2013 15:22
This script creates a nice code editor thanks to the beautiful ace library for the groovy command in jenkins job configurations. The files mode-groovy.js theme-textmate.js should be in the directory jenkins/userContent The ace library itself can be set in the javascript console. This script is tested only with chrome.
ace.config.set("modePath", "/userContent");
ace.config.set("themePath", "/userContent");
var groovyCommand = document.getElementsByName("groovy.command")[0];
groovyCommand.setStyle('position:absolute;top:-10000px;left;-10000px;');
var editor = document.createElement('div');
editor.setAttribute('id','editor');
editor.setStyle('position:relative; width:100%; min-height:500px;');
editor.textContent = groovyCommand.textContent;
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.spi.state.NodeBuilder
class LibsCleaner {
def session
def scanBundles(remove = false) {
@yesil
yesil / rename-node.groovy
Created May 11, 2016 16:53
groovy script to load in oak-run in order to rename protected node names.
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
def fixNodeType(session, nodeType) {
def rootB = session.store.root.builder()
def nodeTypeB = rootB.getChildNode("jcr:system").getChildNode("jcr:nodeTypes").getChildNode(nodeType)
def propertyDefinitionB = nodeTypeB.getChildNode("jcr:propertyDefinition")
def move = propertyDefinitionB.moveTo(nodeTypeB,"jcr:propertyDefinition[1]")
session.store.merge(rootB, EmptyHook.INSTANCE, CommitInfo.EMPTY)
println move ? "success" : "error"
import org.apache.jackrabbit.oak.spi.state.NodeState
import org.apache.jackrabbit.oak.api.Type
class BlobSearch {
def session
def check(){
checkChildren(session.store.root.builder().nodeState)
}
import org.apache.jackrabbit.oak.spi.commit.CommitInfo
import org.apache.jackrabbit.oak.spi.commit.EmptyHook
def removeLucene(session, index) {
def rootB = session.store.root.builder()
def luceneIndex = rootB.getChildNode("oak:index").getChildNode(index)
println luceneIndex.remove() ? "success" : "error"
session.store.merge(rootB, EmptyHook.INSTANCE, CommitInfo.EMPTY)
}
@yesil
yesil / package.json
Last active November 18, 2016 10:19
Simple proxy to alter the POST request content that is sent IdP
{
"name": "samlproxy",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ilyas Türkben",
"license": "ISC",