Skip to content

Instantly share code, notes, and snippets.

import java.awt.*;
import javax.swing.*;
import wiiremotej.*;
import wiiremotej.event.*;
/**
* WiiRemoteJ Nunchuk Excample.
* this source base WiiRemoteJExample(WRLmpl.java)
*/
package components {
import flash.utils.describeType;
import flash.utils.getDefinitionByName;
import mx.core.IFactory;
import mx.core.UIComponent;
import mx.events.FlexEvent;
import mx.utils.ObjectUtil;
public class CloneFactory implements IFactory{
var document = FireGestures.sourceNode.ownerDocument;
var window = document.defaultView;
var x,a,u,q,qq,qg,g='',w=window,d=document,l=d.location,e=encodeURIComponent;
var h=l.href,hs=h.split('?'),i,b,o=new Image,m=d.images;
if(/[^\w\-\.\!\~\*\'\(\)\;\/\?\:\@\&\=\+\$\,\%\#]/.test(hs[0])){
h=encodeURI(hs[0])+(hs[1]?hs[1]:'');
}
b=h.match(/(.*)\/.*$/)[1];
if(m){
package cn.orz.pascal.persistance
import com.db4o.{Db4o, ObjectContainer}
import com.db4o.query.Predicate
import scala.collection.jcl.Conversions.convertList
object Db4oDao {
implicit def toPredicate[E](predicate:(E) => Boolean) = new Predicate[E](){ def `match`(x:E) = predicate(x) }
import scala.util.parsing.json._
object JsonSample {
def main(args : Array[String]) {
//デフォルトは数字は浮動小数
JSON.parse("""[{"test": "hello"},{"test2": {"hoge":3}}]""") match{
case Some(json) => println(json)
}
//perThreadNumberParserでここから数字をBigDesimalに変換するように明示
JSON.perThreadNumberParser = {input : String => BigDecimal(input)}
import java.io._
import java.net._
import scala.io._
import scala.xml._
object Shell {
val sjis = "Shift_JIS"
val utf8 = "UTF8"
val jis = "jis"
object NQueen {
def nq1(n:Int) = {
def _nq(n:Int, x:Int, xs:Set[Int], ys:Set[Int], us:Set[Int], ls:Set[Int]):Int = {
def collision(x:Int, y:Int) = xs(x) || ys(y) || us(y + x) || ls(y - x)
if (n == x) 1
else {
var cnt = 0
for(y <- 0 to n - 1) {
if ( !collision(x, y) ) {
cnt += _nq(n, x+1, xs + x, ys + y, us + (y + x), ls + (y - x))
REM ***** BASIC *****
Sub delete_prev_char
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
Expr ::= Expr + Term | Expr - Term | Term
Term ::= Term * Fact | Term / Fact | Term % Fact| Fact
Fact ::= ( Expr ) | number | +number | -number|
#include <stdio.h>
#include <stdlib.h>
int fib(int n){
// if (n > 100 ) return 1;
return
(n == 0) ? 0
:(n == 1) ? 1
: fib(n-1) + fib(n-2);
}