| Operator | Stack effect | notes |
|---|---|---|
+ |
a b -- |
|
- |
a b -- |
|
* |
a b -- |
|
/ |
a b -- |
|
% |
a b -- |
This file contains hidden or 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
| #!/usr/bin/env ruby | |
| require 'date' | |
| require 'securerandom' | |
| require 'optparse' | |
| def header() | |
| <<~EOS | |
| BEGIN:VCALENDAR | |
| CALSCALE:GREGORIAN | |
| PRODID:-//SENCJW Heavy Industries, Ltd.//CalBot//EN |
This file contains hidden or 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
| Okay, so I'll try and walk through the reader monad as best as I can. And | |
| because I think it helps to de-mystify things a bit, I'll also go through | |
| all of the "super classes" of monad: functor and applicative (because every | |
| monad should also be an applicative and every applicative functor should be | |
| a functor). This file is literate Haskell so you should just be able to | |
| load it in the REPL or run it. It's also kinda/sorta markdown, so it should | |
| render that way as well (but the code is formatted wrong). | |
| > module Reader where |
This file contains hidden or 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
| <!doctype html> | |
| <html lang="en-US"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <title>OpenStreetMap with Leaflet.js</title> | |
| <link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" | |
| integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" | |
| crossorigin=""/> | |
| <script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" | |
| integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" |
This file contains hidden or 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
| -- list types and their enum values | |
| SELECT | |
| pg_type.typname AS enumtype, | |
| array_agg(pg_enum.enumlabel) AS enumlabels | |
| FROM | |
| pg_type | |
| JOIN pg_enum ON pg_enum.enumtypid = pg_type.oid | |
| GROUP BY pg_type.typname; |
This file contains hidden or 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
| # Run with: | |
| # $ rackup app.ru | |
| require 'bundler/inline' | |
| gemfile(true) do | |
| source 'https://rubygems.org' | |
| gem 'rails', '~> 7.0.5' | |
| gem 'puma' | |
| end |
This file contains hidden or 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
| (defun cjw-git-grep (my-word) | |
| "Use git-grep for search in current project (vc-root-dir). Default | |
| search term uses symbol under cursor" | |
| (interactive | |
| (list | |
| (read-string | |
| (format "Search (%s): " (thing-at-point 'symbol)) ; prompt | |
| nil ; initial input | |
| nil ; history list | |
| (thing-at-point 'symbol) ; evaluated. will be default |
This file contains hidden or 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
| {-# LANGUAGE OverloadedStrings #-} | |
| module Main where | |
| import Control.Concurrent | |
| import Control.Concurrent.MVar | |
| import Control.Exception | |
| import Network.AMQP | |
| import Test.Hspec |
This file contains hidden or 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 computus(year) | |
| a = year % 19 # year in the 19-year metonic cycle | |
| k = year / 100 # century index | |
| p = (13 + 8*k) / 25 # shift of metonic cycle, add a day offset every 300 years | |
| q = k / 4 # correction for non-observed leap days | |
| m = (15 - p + k - q) % 30 # correction to starting point each century | |
| d = (19*a + m) % 30 # num of days from 3/21 until full moon | |
| n = (4 + k - q) % 7 # find next sunday; century-based offset in weekly calc. | |
| b = year % 4 # correct for leap days | |
| c = year % 7 # correct for leap days |
This file contains hidden or 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
| #! /usr/bin/env ruby | |
| require 'optparse' | |
| require 'base64' | |
| require 'json' | |
| require 'openssl' | |
| require 'set' | |
| options = {} | |
| OptionParser.new do |parser| |
NewerOlder