Skip to content

Instantly share code, notes, and snippets.

There's a better way to run that benchmark - using the benchmark-ips tool which is designed carefully to allow for optimising implementations of Ruby to do their work and will allow for the JIT to warm up.

require 'benchmark/ips'

def calculate(a, b, n = 40_000_000)
  i = 0
  c = 0
  while i < n
    a = a * 16807 % 2147483647
@Phlow
Phlow / loop-category.liquid
Last active March 10, 2022 12:02
This Liquid loop for Jekyll loops through a defined category of your choice. Use this code-snippet as an include
{% comment %}
*
* This loop loops through a category of your choice and lists
* all entries. To address the category of your linking use the
* include like this:
*
* {% include loop-category category='webdesign' %}
*
{% endcomment %}
@busypeoples
busypeoples / ReactGame.js
Last active January 16, 2018 08:10
ReactGame Example: React + Flow
// @flow
import React from 'react';
import { render } from 'react-dom';
type Field = 0 | 1;
type Position = [Field, Field, Field, Field];
type Unit = [Position, Position, Position, Position];
@busypeoples
busypeoples / Game.re
Last active January 7, 2018 22:08
ReasonML Game
type field =
| O
| X;
type position = (field, field, field, field);
type unit = (position, position, position, position);
type units = list(unit);
@mraaroncruz
mraaroncruz / george.rb
Created December 10, 2017 20:10
george is down
require "typhoeus"
loop do
puts "In Loop"
res = Typhoeus.get("https://george.sparkasse.at/")
if res.success?
unless res.body =~ /George arbeitet an sich/
`say "George is back online!"`
return
end
@gettalong
gettalong / README.md
Last active June 3, 2025 13:50
HexaPDF examples

HexaPDF - A Versatile PDF Creation and Manipulation Library For Ruby

HexaPDF is a pure Ruby library with an accompanying application for working with PDF files. In short, it allows

  • creating new PDF files,
  • manipulating existing PDF files,
  • merging multiple PDF files into one,
  • extracting meta information, text, images and files from PDF files,
  • securing PDF files by encrypting them and
  • optimizing PDF files for smaller file size or other criteria.
@mraaroncruz
mraaroncruz / dokku.md
Last active December 8, 2017 11:30
Some docker

Deploy to Dokku Steps

  • Create droplet on DIGIOCEAN
  • Update DNS
  • install dokku
wget https://raw.githubusercontent.com/dokku/dokku/v0.10.5/bootstrap.sh;
sudo DOKKU_TAG=v0.10.5 bash bootstrap.sh
@koeckc
koeckc / docker-compose.yml
Created December 8, 2017 08:37
Docker compose file Ruby Meeting
version: '2'
services:
postgres:
restart: always
image: kiasaki/alpine-postgres:9.5
environment:
- POSTGRES_USER:'root'
- POSTGRES_PASSWORD:'root'
ports:
- '5432:5432'
@koeckc
koeckc / Dockerfile
Created December 8, 2017 08:35
Dockerfile ruby meeting
#
# Use the barebones version of Ruby 2.2.3.
FROM ruby:2.3.5-slim
# Optionally set a maintainer name to let people know who made this image.
MAINTAINER C.Köck <[email protected]>
# Install dependencies:
@busypeoples
busypeoples / reason-remote-data.re
Last active September 7, 2019 14:13
ReasonML port remote-data
/*
remote-data ported to ReasonML
See also https://github.com/krisajenkins/remotedata
Tools for fetching data from remote sources (incl. HTTP).
*/
type remoteData 'e 'a
= NotAsked
| Loading