Skip to content

Instantly share code, notes, and snippets.

require 'libical'
array = MemoryPointer.new(:int,10)
LibIcal.icalrecur_expand_recurrence("FREQ=YEARLY;BYDAY=SU,WE",Time.now.to_i,10,array)
times = array.read_array_of_int(10).map {|s| Time.at(s)}
times.each {|s| puts s}
<container> <position>280</position> <position>140</position> <xtype>jsBox</xtype> <codeText>function() { return 3; }</codeText></container>
<container> <position>500</position> <position>150</position> <xtype>jsBox</xtype> <codeText>function() { return 6; }</codeText></container>
<container> <position>400</position> <position>280</position> <xtype>jsBox</xtype> <codeText>function(a,b) { return a*b; }</codeText></container>
<container> <position>450</position> <position>440</position> <xtype>jsBox</xtype> <codeText>function(result) { alert('the result is '+result); }</codeText></container>
<wire> <src> <moduleId>0</moduleId> <terminalId>0</terminalId></src> <tgt> <moduleId>2</moduleId> <terminalId>0</terminalId></tgt></wire>
<wire> <src> <moduleId>1</moduleId> <terminalId>0</terminalId></src> <tgt> <moduleId>2</moduleId> <terminalId>1</terminalId></tgt></wire>
<wire> <src> <moduleId>2</moduleId> <terminalId>2</terminalId></src> <tgt> <moduleId>3</moduleId> <terminalId>0</terminalId></tgt></wire>
{
"containers":
[
{"codeText":"function() {\n return 3;\n}","position":[280,140],"xtype":"jsBox"},
{"codeText":"function() {\n return 6;\n}","position":[500,150],"xtype":"jsBox"},
{"codeText":"function(a,b) {\n return a*b;\n}","position":[400,280],"xtype":"jsBox"},
{"codeText":"function(result) {\n alert('the result is '+result);\n}","position":[450,440],"xtype":"jsBox"}
],
"wires":
[
-- Out of curiousity, a take on Igal's language comparison in Haskell http://gist.github.com/126387
-- Goal: Turn Array `["foo", "bar", "baz"]` into String `"ordered: 1=foo 2=bar 3=baz"`.
-- Haskell
-- Read arguments from command line
-- (def argv *command-line-args*)
import Data.List(intercalate)
-- Fake command-line arguments for use in REPL
TODO: Extend markermanager.js to execute an arbitrary function upon a marker's addition to the current map viewport.
stylesheet -xmlns:xsl=http://www.w3.org/1999/XSL/Transform -version=2.0
output -indent=yes
param file 'example.csv'
template /
for-each tokenize(unparsed-text($file),'\r?\n')
row
for-each tokenize(.,',')
item
value-of .
import javax.servlet.http.*;
import javax.servlet.ServletOutputStream;
import java.io.InputStream;
import org.apache.commons.fileupload.FileItemIterator;
import org.apache.commons.fileupload.FileItemStream;
import org.apache.commons.fileupload.FileUploadException;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
public class ExampleServlet extends HttpServlet {
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom">
<xsl:template match="atom:entry">
<xsl:for-each select="atom:link[@rel='enclosure']">
<xsl:apply-templates select=".." mode="copy">
<xsl:with-param name="enclosure" select="position()"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:template>
import scala.xml.{Elem, NodeSeq}
object Match {
val input =
<square>
<double><val>3</val></double>
</square>
//def proc(input:NodeSeq):Function1[Int, Int] = input match {
def proc(input:NodeSeq):Int = input match {
import net.sf.saxon.functions.ExtensionFunctionCall
import net.sf.saxon.om.SequenceIterator
import net.sf.saxon.om.SingletonIterator.makeIterator
import net.sf.saxon.om.SingleNodeIterator
import net.sf.saxon.expr.XPathContext
import net.sf.saxon.om.StructuredQName
import net.sf.saxon.value.SequenceType.{SINGLE_STRING, SINGLE_ELEMENT_NODE}
import net.sf.saxon.value.StringValue
class ExtFunCall extends ExtensionFunctionCall {