Skip to content

Instantly share code, notes, and snippets.

@andphe
andphe / gist:3232343
Created August 2, 2012 01:41
Export your links from Safari reading list
/usr/bin/plutil -convert xml1 -o - ~/Library/Safari/Bookmarks.plist | grep -E -o '<string>http[s]{0,1}://.*</string>' | grep -v icloud | sed -E 's/<\/{0,1}string>//g'
@mstevenson
mstevenson / CreateQuadMesh.cs
Created December 27, 2012 00:36
Create a quad mesh asset in Unity. Place this script in the Editor folder.
using System;
using UnityEngine;
using UnityEditor;
public class CreateQuadMesh : Editor {
[MenuItem("Assets/Create/Quad Mesh", false, 10000)]
public static void Create ()
{
Mesh mesh = BuildQuad (1, 1);
@whoahbot
whoahbot / clojure-west.org
Last active October 13, 2016 07:41
Clojure west notes

Clojure West

Domain driven design with Clojure

  • Organizing larger applications
  • Domain logic shouldn’t include handlers for bad/unclean data.
    • validateur, bouncer, clj-schema for checking data going into the pipeline.
    • domain-specific, semantic checks
    • TODO: Any better ways for doing this conditional validation.
    • Need to factor out common data cleaning utils into shared library.
@weavejester
weavejester / gist:5484183
Created April 29, 2013 19:45
jMonkeyEngine in Clojure example
(ns jme3-example.core
(:import com.jme3.app.SimpleApplication
com.jme3.material.Material
com.jme3.math.Vector3f
com.jme3.scene.Geometry
com.jme3.scene.shape.Box
com.jme3.texture.Texture))
(defn application
"Create an jMonkeyEngine application."
@rm-hull
rm-hull / quadratic-residues.cljs
Last active June 30, 2016 22:24
Exploring quadratic residues and fixed points with clock arithmetic and digraphs, in Clojurescript with force-directed graph layout provided by _arbor.js_. Inspired, in part, by http://pi3.sites.sheffield.ac.uk/tutorials/week-8. Defaults to 51 data points, which produces a pleasing digraph, but add a _num=X_ param to the URL to show different ri…
(ns quadratic-residue.demo.core)
(defn follow [lookup-table]
(fn [n]
(loop [k n
edges {}]
(let [next-k (lookup-table k)]
(if (edges next-k)
edges
(recur next-k (assoc edges k next-k)))))))
@wvdlaan
wvdlaan / core.clj
Last active March 16, 2018 06:53
Datomic multiple attribute key example
(ns myupsert.core
(require [datomic.api :as d]))
(def schema
[
{:db/id #db/id [:db.part/db]
:db/ident :product/name
:db/valueType :db.type/string
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
@drublic
drublic / keep-focus.js
Last active March 29, 2017 15:20
A function that lets you circularly tab through a part of a page.
var tabbableElements = 'a[href], area[href], input:not([disabled]),' +
'select:not([disabled]), textarea:not([disabled]),' +
'button:not([disabled]), iframe, object, embed, *[tabindex],' +
'*[contenteditable]';
var keepFocus = function (context) {
var allTabbableElements = context.querySelectorAll(tabbableElements);
var firstTabbableElement = allTabbableElements[0];
var lastTabbableElement = allTabbableElements[allTabbableElements.length - 1];
@joechrysler
joechrysler / who_is_my_mummy.sh
Last active May 14, 2024 12:26
Find the nearest parent branch of the current git branch
#!/usr/bin/env zsh
git show-branch -a \
| grep '\*' \
| grep -v `git rev-parse --abbrev-ref HEAD` \
| head -n1 \
| sed 's/.*\[\(.*\)\].*/\1/' \
| sed 's/[\^~].*//'
# How it works:
@mustafaturan
mustafaturan / latest-ffmpeg-centos6.sh
Last active October 25, 2022 20:14
Installs latest ffmpeg on Centos 6
# source: https://trac.ffmpeg.org/wiki/CentosCompilationGuide
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
# Mac preference changes:
# * minimize and hide dock
# * undo natural scrolling
# * max out keyboard repeat
# * increase desktop resolution
# * show date in menubar
# * do not play feedback when volume is changed
# * do not play user interface sounds
# * maximize mouse tracking speed