- High level overview https://yogthos.github.io/ClojureDistilled.html
- An Animated Introduction to Clojure https://markm208.github.io/cljbook/
- Interactive tutorial in a browser https://tryclojure.org/
- Interactive exercises http://clojurescriptkoans.com/
- Clerk notebooks with introductory examples https://github.clerk.garden/anthonygalea/notes-on-clojure
- More interactive exercises https://4clojure.oxal.org/
- Lambda Island tutorials https://lambdaisland.com/
- Functional Programming with Clojure resources https://practicalli.github.io/
module GTK | |
class Runtime | |
def draw_circle c | |
radius = c.radius.to_i || 0 | |
xc = c.x.to_i + radius | |
yc = c.y.to_i + radius | |
t = c.thickness || 1 | |
r = c.r || 0 | |
g = c.g || 0 | |
b = c.b || 0 |
def create_vertices rect | |
x = rect.x; y = rect.y | |
w = rect.w; h = rect.h | |
cx = x + w * 0.5; cy = y + h * 0.5 | |
sin = Math.sin (rect.angle || 0.0).to_radians; cos = Math.cos (rect.angle || 0.0).to_radians | |
[ | |
[(x - cx) * cos - (y + h - cy) * sin + cx, (x - cx) * sin + (y + h - cy) * cos + cy], # Top Left | |
[(x + w - cx) * cos - (y + h - cy) * sin + cx, (x + w - cx) * sin + (y + h - cy) * cos + cy], # Top Right | |
[(x + w - cx) * cos - (y - cy) * sin + cx, (x + w - cx) * sin + (y - cy) * cos + cy], # Bottom Right | |
[(x - cx) * cos - (y - cy) * sin + cx, (x - cx) * sin + (y - cy) * cos + cy] # Bottom Left |
# coding: utf-8 | |
module Geometry | |
class Points | |
def initialize array | |
@array = array | |
end | |
def point_inside? point | |
return false unless point.inside_rect? rect | |
winding_number(point) == 0 |
This is a script for checking if any of the passwords you have stored in LastPass have been exposed through previous data breaches.
To use the script you need to have Python 3 installed and you need a CSV export of your LastPass vault. The export can be generated from the LastPass CLI with:
lpass export > lastpass.csv
or can be extracted with the browser plugin by going to the LastPass icon → More Options → Advanced → Export → LastPass CSV File (note that I did have problems getting this to work).
// Thanks to @MonsieurDart for the idea :) | |
func scroll(collectionView:XCUIElement, toFindCellWithId identifier:String) -> XCUIElement? { | |
guard collectionView.elementType == .collectionView else { | |
fatalError("XCUIElement is not a collectionView.") | |
} | |
var reachedTheEnd = false | |
var allVisibleElements = [String]() | |
while !reachedTheEnd { |
State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?
There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.
Here I present a composable pattern for pure state machiness with effects,
Here's my own list of the interesting stuff announced during this year's WWDC, collected from the keynotes, various Apple docs, blog posts and tweets.
If you're planning to watch the videos, I really recommend this Mac app that helps you download and watch them: https://github.com/insidegui/WWDC.
http://www.apple.com/osx/elcapitan-preview/
- split view - two apps side by side on full screen
#!/bin/bash | |
# This will add lauchd to the list of allowed processes for accessibility access | |
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db "INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','/sbin/launchd',1,1,1,NULL)" | |
# This outputs the rows in the TCC database | |
sudo sqlite3 /Library/Application\ Support/com.apple.TCC/TCC.db 'select * from access' | |
echo "Restart is required for these changes to take effect" |
#!/bin/bash -e | |
# | |
# package-ipa.sh | |
# | |
# Bundles an iOS app correctly, using the same directory structure that Xcode does when using the export functionality. | |
# | |
xcarchive="$1" | |
output_ipa="$2" |