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
object rdfStringOps { | |
import org.openrdf.model._ | |
private lazy val vf = impl.ValueFactoryImpl.getInstance | |
implicit class RDFStringOps( val str:String ){ | |
def uri = vf createURI str | |
def lit = vf createLiteral str |
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
# triples for a given entity | |
curl -H "Accept: text/turtle" -X GET "https://graph.facebook.com/aldo.bucchi" | |
# with metadata ( triples for properties / schema ) | |
curl -H "Accept: text/turtle" -X GET "https://graph.facebook.com/aldo.bucchi?metadata=1" | |
# of course you can pass an access token to gain access to a broader piece of the graph | |
curl -H "Accept: text/turtle" -X GET "https://graph.facebook.com/aldo.bucchi&access_token=TOKEN" | |
# to get a fresh ( but short lived ) token browse to: |
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.forName(c).getProtectionDomain.getCodeSource.getLocation() |
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
function _map( coll, f ){ | |
var res = [] | |
var isIterator = ( typeof coll.next == "function" ) | |
var isArray = ( coll instanceof Array ) | |
var hasFunc = ( typeof f == "function" ) | |
var append = function(e){ res.push( hasFunc ? f(e) : e ) } | |
if( isIterator ){ | |
while( coll.hasNext() ){ append( coll.next() ) } | |
} else if ( isArray ) { | |
coll.forEach(append) |
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
object x { | |
// stream a sql query | |
def sql( str:String ):Stream[ResultSet] = withStatement { s => | |
val rs = s executeQuery str | |
new Iterator[ResultSet] { def hasNext = rs.next ; def next = rs }.toStream | |
} | |
// loan a sql statement |
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
package radioactivejs | |
import org.scalajs.dom | |
import _root_.util.StackVal | |
import org.scalajs.dom.{Event, HTMLElement} | |
import scala.collection.mutable | |
import scala.util.Try | |
import scala.scalajs.js | |
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
radioactive.react(function(){ | |
var userId = getTextInputValue(); | |
var userName = getNameFromServer( userId ); | |
console.log( userName ); | |
}) |
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
I, Aldo Bucchi, have read and do accept the MuleSoft Contributor Agreement | |
at http://www.mulesoft.org/legal/contributor-agreement.html | |
Accepted on Wed Dec 24 2014 17:57:06 GMT-0300 (CLST) |
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
##1 How-to | |
Everybody knows what **looping** over a collection is. But do you know what **reducing** a collection means? | |
No? Are you sure? | |
It sounds scary. But it is in fact pretty simple. You do it all the time. | |
Here. Let me show you an example: | |
<!--code lang=javascript linenums=true--> |
OlderNewer