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
angular | |
.module('hoge') | |
.factory('hogeFactory', function(){ | |
function func1 (){} | |
function func2 (){} | |
function func3 (){} | |
return { | |
func1: function(){ | |
return func1(); | |
}, |
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
(defn num-vec [str] | |
(map #(- (int %) (int \0)) (seq str))) | |
(defn num-vec-stringize [vec] | |
(clojure.string/join (map str vec))) | |
(defn binarize [vec] | |
(map #(if (= 0 %) 0 1) vec)) | |
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 ramen | |
String timePassed(String seats){ | |
return seats.replaceAll("3", "0").replaceAll("2", "3").replaceAll("1", "2"); | |
} | |
String sitdown(String seats, int n){ | |
def seats_ = (seats + seats).replaceFirst("0{${n}}", "1" * n); | |
def result = ""; | |
for(int i = 0; i < 8; i++) { |
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 Data.List | |
data Status = Empty | Wait | Eating | Rest deriving (Eq, Show) | |
timePassed Empty = Empty | |
timePassed Wait = Eating | |
timePassed Eating = Rest | |
timePassed Rest = Empty | |
rotate seats = |
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 <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
/* | |
最上位から探索して0ビットが初めて出現する位置を返す。 | |
*/ | |
int findZeroBit(unsigned char table, int n){ | |
return (table >> (7 - n)) & 0x1; | |
} |
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
(defn num-vec [str] | |
(map #(- (int %) (int \0)) (seq str))) | |
(defn num-vec-stringize [vec] | |
(clojure.string/join (map str vec))) | |
(defn binarize [vec] | |
(map #(if (= 0 %) 0 1) vec)) | |