Skip to content

Instantly share code, notes, and snippets.

View bgnori's full-sized avatar

Noriyuki Hosaka bgnori

  • Itabashi, Tokyo, Japan
View GitHub Profile
s = "ab[cd]ef"
expected = ['a', 'b', ['c', 'd' ], 'e', 'f']
def parse(xs)
result = []
@bgnori
bgnori / gist:2567887
Created May 1, 2012 13:25
aoj vol0 0017 Caesar Cipher
#include<stdio.h>
#include<string.h>
#define s_plen(STR) STR,strlen(STR)
#define test_the(p, len) test_xxx((p), (len),s_plen("the"))
#define test_that(p, len) test_xxx((p), (len), s_plen("that"))
#define test_this(p, len) test_xxx((p), (len), s_plen("this"))
def shortest(*rs):
i = 0;
while True:
for r in rs:
try:
x = r[i]
except IndexError:
return r
i += 1
pass
import sys
def _each(f, xs):
x = xs[0]
f(x)
if xs[1:]:
_each(f, xs[1:])
def _shortest(i, *rs):
[nori@akagi]~/Desktop/work/cloft/cloft% git diff
diff --git a/src/cloft/core.clj b/src/cloft/core.clj
index 34ccb7a..80c2fd5 100644
--- a/src/cloft/core.clj
+++ b/src/cloft/core.clj
@@ -20,6 +20,7 @@
(:import [org.bukkit.potion Potion PotionEffect PotionEffectType])
(:import [org.bukkit.inventory ItemStack]))
+
(defn make-arrow-skill-updater [skill-name]
(defn updater [player]
(c/broadcast (.getDisplayName player) " changed arrow-skill to " (last skill-name))
(swap! arrow-skill assoc (.getDisplayName player) (first skill-name))
))
(defn skillchange [player block block-against]
(when (and
(every? identity (map
#(=
[nori@akagi]~/Desktop/work/cloft/cloft% git diff ujm
diff --git a/src/cloft/core.clj b/src/cloft/core.clj
index 6bea28c..a7aec90 100644
--- a/src/cloft/core.clj
+++ b/src/cloft/core.clj
@@ -362,10 +362,22 @@
; (.setType newblock (.getType block)))))))))
;
+
nori@akagi]~/Desktop/work/cloft/cloft% git diff
diff --git a/src/cloft/core.clj b/src/cloft/core.clj
index 6bea28c..9565b1b 100644
--- a/src/cloft/core.clj
+++ b/src/cloft/core.clj
@@ -362,6 +362,21 @@
; (.setType newblock (.getType block)))))))))
;
+
(defn fusion-wall [player]
(let [world (.getWorld player)
loc (.getLocation player)
direction (.normalize (.setY (.getDirection loc) 0))
perpendicular (.normalize ( .setZ (.setY (.setX direction ;fixme
(.getZ direction)
)
0.0 )
(* -1 (.getX direction))
))
@bgnori
bgnori / android,UI,AlertDialog(3buttons)
Created May 5, 2012 11:46 — forked from nommy/android,UI,AlertDialog(3buttons)
android,UI,AlertDialog(3buttons),shortcode version
package com.DialogTest;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.os.Bundle;
public class AlertDialogTest2Activity extends Activity {
/** Called when the activity is first created. */