GitHub::SQL has been released as an officially-maintained project and ruby gem: github/github-ds.
| // | |
| // PSPDFThreadSafeMutableDictionary.m | |
| // | |
| // Copyright (c) 2013 Peter Steinberger, PSPDFKit GmbH. All rights reserved. | |
| // | |
| // Permission is hereby granted, free of charge, to any person obtaining a copy | |
| // of this software and associated documentation files (the "Software"), to deal | |
| // in the Software without restriction, including without limitation the rights | |
| // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| // copies of the Software, and to permit persons to whom the Software is |
| // cc aviary.m -o aviary -framework Foundation -fobjc-arc && ./aviary | |
| #import <Foundation/Foundation.h> | |
| // use it like lambda(…args…)(…return value…) | |
| #define lambda(...) \ | |
| ^ (__VA_ARGS__) _lambda_body | |
| #define _lambda_body(...) \ | |
| { return __VA_ARGS__; } |
A list of commonly asked questions, design decisions, reasons why Clojure is the way it is as they were answered directly by Rich (even when from many years ago, those answers are pretty much valid today!). Feel free to point friends and colleagues here next time they ask (again). Answers are pasted verbatim (I've made small adjustments for readibility, but never changed a sentence) from mailing lists, articles, chats.
How to use:
- The link in the table of content jumps at the copy of the answer on this page.
- The link on the answer itself points back at the original post.
| defmodule Day20 do | |
| def part1() do | |
| {id, _particle} = Enum.min_by(particles(), &particle_weight/1) | |
| id | |
| end | |
| def part2() do | |
| particles = particles() | |
| count_survivors(particles, sorted_collisions(particles)) | |
| end |
| import re | |
| from cmath import sqrt | |
| from collections import defaultdict, namedtuple | |
| from functools import reduce | |
| from itertools import combinations | |
| from time import time | |
| Particle = namedtuple('Particle', ['pos', 'vel', 'acc']) | |
| def parse_particle(line): |
Using JavaScript libraries from ClojureScript involves two distinct concerns:
- Packaging the code and delivering it to the browser
- Making ClojureScript code that accesses JavaScript libraries safe for advanced optimization
Right now, the only single tool that solves these probems reliably, optimally, and with minimal configuration is shadow-cljs, and so that is what I favor. In paricular, shadow-cljs lets you install npm modules using npm or yarn and uses the resulting package.json to bundle external dependencies. Below I describe why, what alternatives there are, and what solutions I disfavor at this time.
Hi, I'm mcpower. I've done Advent of Code seriously for two years now in Python, placing 9th in 2018 and 12th in 2017. This year, I'm taking a break from aiming for the leaderboard - while it's fun and all, it is a bit stressful at times (the good kind of stress, though!). As such, I'd like to share a few tips for anyone wanting to aim for the leaderboard.
This is everything that worked for me. Your mileage may vary, though - don't take this as gospel, see what works for you.
Go fast.
| #!/bin/bash | |
| # Colors | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| NO_COLOR='\033[0m' | |
| BLUE='\033[0;34m' | |
| YELLOW='\033[0;33m' | |
| NO_COLOR='\033[0m' |