Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am zaeleus on github.
  • I am zaeleus (https://keybase.io/zaeleus) on keybase.
  • I have a public key ASB_nqsac7dnv23Eub4dHq6t1TGbcex7sjYHQi5Q1iFaqgo

To claim this, I am signing this object:

import React from 'react';
import { render } from 'react-dom';
import { connect, Provider as ReduxProvider } from "react-redux";
import { BaseLink, RouterProvider } from 'react-router5';
import { applyMiddleware, combineReducers, createStore } from 'redux';
import { routeNodeSelector, router5Middleware, router5Reducer } from 'redux-router5';
import createRouter from 'router5';
import browserPlugin from 'router5/plugins/browser';
const App = ({ route }) => {
require 'shrine'
require 'shrine/storage/memory'
Shrine.storages = {
cache: Shrine::Storage::Memory.new,
store: Shrine::Storage::Memory.new
}
class DocumentUploader < Shrine
plugin :determine_mime_type
@zaeleus
zaeleus / acmhash.rs
Last active August 29, 2015 14:07
Rust solution to the fall 2014 University of Mississippi ACM hashing competition
// Michael Macias <[email protected]>
// created 2014-10-02, updated 2014-10-13
// rust 0.12.0
// MIT license (http://opensource.org/licenses/MIT)
//
// acmhash.rs is a Rust solution to the fall 2014 University of Mississippi
// ACM hashing competition (http://micha.elwillia.ms/). The goal is to find
// an input so that the SHA-256 cryptographic hash function produces a digest
// with the most leading zeros. For example, the word "mismatchment" has 4
// leading zeros.
source 'https://rubygems.org'
gem 'sinatra', '~> 1.4.5'
gem 'ffi-gphoto2', '~> 0.5.0'
@zaeleus
zaeleus / rps.rb
Last active December 24, 2015 00:49
Rock-paper-scissors code golf solution to <https://icpcarchive.ecs.baylor.edu/external/40/4065.pdf>. 168 characters.
M=%w[R S P];S=STDIN;S.gets.to_i.times{t=0;S.gets.to_i.times{i,j=S.gets.split.map{|a|M.index(a)};M[i-2]==M[j]?t+=1:M[i]!=M[j]&&t-=1};puts t==0?"TIE":"Player #{t>0?1:2}"}
From 2587a13c97b654175d7cf68f2b969d37d42c5fea Mon Sep 17 00:00:00 2001
From: Michael Macias <[email protected]>
Date: Wed, 13 Mar 2013 15:42:34 -0500
Subject: [PATCH] Add NArray#map alias for NArray#collect
---
narray.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/narray.c b/narray.c
@zaeleus
zaeleus / gitlab_centos6.txt
Created December 23, 2012 08:04
Gitlab install on CentOS 6.3 (2012-09-13)
-- install packages
# yum update
# yum groupinstall "Development Tools" "Additional Development"
-- epel for redis, libyaml, pip, qtwebkit-devel
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
# yum install libicu-devel libyaml-devel redis wget python-pip qt-devel qtwebkit-devel
-- install ruby
n = 5_000_000
puts Benchmark.measure { n.times { Float("9.0") } }
puts Benchmark.measure { n.times { "9.0".to_f } }
def self.coerce_to_float(obj, strict=false)
case obj
when Numeric
coerce_to obj, Float, :to_f
when Float
return obj
when String
result = Rubinius.invoke_primitive :string_to_f, obj, strict
raise ArgumentError, "invalid value for Float" if result.nil?
result