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
from xml.dom import minidom | |
root = minidom.parse("weave.svg") | |
joinCount = 0 | |
lines = [] | |
for l1 in root.getElementsByTagName("line"): | |
x1 = l1.attributes['x1'].value | |
y1 = l1.attributes['y1'].value |
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
require "qrencode" | |
require "stumpy_png" | |
include StumpyPNG | |
qr = QRencode::QRcode.new("this is my input string") | |
margin = 20 | |
size_with_margin = 300 | |
size = size_with_margin - (margin * 2) |
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 <iostream> | |
#include <string> | |
using namespace std; | |
class Book | |
{ | |
string m_title; | |
string m_author; | |
string m_isbn; |
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
require "./point" | |
require "./vector" | |
require "./aabb" | |
require "./ray" | |
require "./color" | |
require "./normal" | |
require "./materials/*" | |
require "./hitable" | |
struct ExtendedRay |
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
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0"> | |
<style> | |
body { | |
margin: 0px; | |
overflow: hidden; | |
} | |
</style> |
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
def test1 | |
puts (1..10).to_a.map { |a| a.to_s }.join | |
end | |
def test2 | |
puts((1..10).to_a.map { |a| a.to_s }.join) | |
end | |
def test3 | |
puts (1..10).to_a.map do |a| |
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
require 'benchmark/ips' | |
require 'ruby-prof' | |
seq1 = 'GAGCCTACTAACGGGAT' | |
seq2 = 'CATCGTAATGACGGCCT' | |
module Allocation | |
def self.count | |
GC.disable | |
before = ObjectSpace.count_objects |
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
fizz = ["","","Fizz"].lazy.cycle | |
buzz = ["","","","","Buzz"].lazy.cycle | |
numbers = (1..Float::INFINITY).lazy | |
fizzbuzz = numbers.zip(fizz,buzz).map do |n,f,b| | |
(f.empty? && b.empty?) ? n.to_s : f + b | |
end | |
puts fizzbuzz.take(20).to_a |
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 java.util.*; | |
class MinMax extends Thread | |
{ | |
int[] data; | |
boolean computeMin; | |
public int result = 0; | |
public MinMax(int[] f, boolean min){ | |
data = f; |
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
defmodule NLP do | |
def ngrams(0, _), do: [] | |
def ngrams(_, []), do: [] | |
def ngrams(n, list) do | |
ngrams(n, list, []) | |
end | |
def ngrams(n, list, acc) do | |
ngram = Enum.take(list, n) |
NewerOlder