Probably not comprehensive, and in no particular order...
integer literal1Y| feature name | example | include? |
|---|---|---|
| string interpolation | “a#{b}” | Y |
| assignment | a = b | Y |
| single-line comment | # comment | Y |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| $stack, $draws = [], {} | |
| def method_missing *args | |
| return if args[0][/^to_/] | |
| $stack << args.map { |a| a or $stack.pop } | |
| $draws[$stack.pop(2)[0][0]] = args[1] if args[0] == :< | |
| end | |
| class Array | |
| def +@ |
| (defun my-send-to-nrepl () | |
| (interactive) | |
| (let ((p (point))) | |
| (cider-eval-last-sexp 't) | |
| (goto-char p) | |
| (insert " ;;=> "))) | |
| (defun my-send-to-nrepl2 () | |
| (interactive) | |
| (let ((p (point))) |
| instance Options MainOptions where | |
| defineOptions = | |
| MainOptions <$> defineOption optionType_bool a_help | |
| <*> defineOption optionType_bool a_version | |
| <*> defineOption optionType_string a_path | |
| where a_help opt = opt { optionLongFlags = ["help"] | |
| , optionShortFlags = ['h'] | |
| } | |
| a_version opt = opt { optionLongFlags = ["version"] | |
| , optionShortFlags = ['v'] |
| (<|>) :: Parser a -> Parser a -> Parser a | |
| parser1 <|> parser2 = P $ \some -> case parse parser1 some of | |
| [] -> parse parser2 some | |
| result -> result |
| from __future__ import division | |
| import string | |
| import math | |
| tokenize = lambda doc: doc.lower().split(" ") | |
| document_0 = "China has a strong economy that is growing at a rapid pace. However politically it differs greatly from the US Economy." | |
| document_1 = "At last, China seems serious about confronting an endemic problem: domestic violence and corruption." | |
| document_2 = "Japan's prime minister, Shinzo Abe, is working towards healing the economic turmoil in his own country for his view on the future of his people." | |
| document_3 = "Vladimir Putin is working hard to fix the economy in Russia as the Ruble has tumbled." |
| gem 'rails', '4.2.1' # prob works on others, too, but this is the one I figured it out on | |
| require "rails" | |
| require 'active_record' | |
| require 'action_controller/railtie' | |
| require 'action_view/railtie' | |
| # ===== Configuration ===== | |
| Rails.logger = ActiveRecord::Base.logger = Logger.new $stdout | |
| ActiveSupport::LogSubscriber.colorize_logging = false |
| {-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-} | |
| {-# LANGUAGE TypeFamilies, FlexibleInstances, ScopedTypeVariables #-} | |
| {-# LANGUAGE InstanceSigs #-} | |
| module TinyServant where | |
| import Control.Applicative | |
| import GHC.TypeLits | |
| import Text.Read | |
| import Data.Time |