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
;; http://www2.oninet.ne.jp/mazra/math104.htm | |
(ns grape | |
(:refer-clojure :exclude [record? ==]) | |
(:require [clojure.core.logic.fd :as fd]) | |
(:use [clojure.core.logic])) | |
(clojure.pprint/pprint | |
(run* [q] | |
(fresh [a0 a1 a2 a3 a4 b0 b1 b2 b3 c0 c1 c2 d0 d1 e0 xs] |
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
# http://ja.wikipedia.org/wiki/%E3%82%B7%E3%83%BC%E3%82%AF%E3%83%AE%E3%83%BC%E3%82%B5%E3%83%BC#.E8.A1.A8.E8.A8.98 | |
require 'pp' | |
shikwasa = { | |
'シ' => ['ィ', 'イ', 'ー1'], | |
'ィ' => ['ー1', 'ク'], | |
'イ' => ['ー1', 'ク'], | |
'ー1' => ['ク'], | |
'ク' => ['ァ', 'ア', 'ヮ', 'ワ'], |
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
extern crate time; | |
fn main() { | |
let now = time::now(); | |
let year = now.tm_year as uint + 1900; | |
let month = now.tm_mon as uint + 1; | |
let first_wday = { | |
let mut t = now.clone(); | |
t.tm_mday = 1; |
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
(ns markov | |
(:require [cljs.nodejs :as nodejs] | |
[clojure.string :refer [join replace]])) | |
(def kuromoji (nodejs/require "kuromoji")) | |
(defn wakachi [tokenizer sentence] | |
(->> (js->clj (.tokenize tokenizer sentence) :keywordize-keys true) | |
(map :surface_form))) |
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
import math | |
import os | |
import sequtils | |
import strutils | |
const libmecab = "libmecab.2.dylib" | |
type mecab_node_t = object | |
prev: ptr mecab_node_t | |
next: ptr mecab_node_t |
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
;; Rouge 0.0.14 | |
(require "oauth") | |
(def *consumer-key* "YOUR CONSUMER KEY") | |
(def *consumer-secret* "YOUR CONSUMER SECRET") | |
(let [consumer-token (OAuth.Consumer. *consumer-key* *consumer-secret* | |
{:site "https://api.twitter.com/"}) | |
request-token (.get_request_token consumer-token)] |
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
;; Rouge 0.0.14 | |
(require "base64") | |
(require "mime/types") | |
(let [filename (nth ARGV 0)] | |
(let [data-type (-> filename MIME.Types/of first) | |
data-str (-> filename Kernel/open .read Base64/encode64)] | |
(.write (Kernel/open (str (File/basename filename) ".html") "wb") | |
(str "<!DOCTYPE html>\n" "<img src=\"data:" data-type ";base64," data-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
// in the view controller | |
UIWindow* window = [[UIApplication sharedApplication] keyWindow]; | |
UINavigationController* navigationController = (UINavigationController *)[window rootViewController]; | |
[UIView transitionWithView:self.view | |
duration:UINavigationControllerHideShowBarDuration | |
options:UIViewAnimationOptionCurveLinear | |
animations:^{ | |
[navigationController setNavigationBarHidden:YES animated:NO]; |
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
#include <fstream> | |
#include <string> | |
#include <iostream> | |
int main() { | |
std::ifstream stream{"fujiyama.txt"}; | |
std::string buffer{std::istreambuf_iterator<char>(stream), std::istreambuf_iterator<char>()}; | |
std::cout << buffer << std::endl; |
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
;; Rouge 0.0.15 | |
(require "glut") | |
(require "opengl") | |
(def vertex-shader " | |
attribute vec3 position; | |
attribute vec4 color; | |
varying vec4 vertex_color; | |
OlderNewer