Skip to content

Instantly share code, notes, and snippets.

@mattdeboard
mattdeboard / gist:1866001
Created February 19, 2012 21:46
4clojure #53
;; Breaks on [2 3 3 4 5]
;; http://www.4clojure.com/problem/53#prob-title
(defn subseq- [coll]
(partition-by (fn [x] (= 1 (- (second x) (first x))))
(filter #(< (first %) (second %))
(partition 2 1 coll))))
;; Example
(def test-vecs [[1 0 1 2 3 0 4 5] [5 6 1 3 2 7] [2 3 3 4 5] [7 6 5 4]])
;; With numeric ARG, display the tool bar if and only if ARG is
;; positive. Tool bar has icons document (read file), folder (read
;; directory), X (discard buffer), disk (save), disk+pen (save-as),
;; back arrow (undo), scissors (cut), etc.
(tool-bar-mode 0)
;; Get rid of the annoying splash and startup screens
(setq inhibit-splash-screen t
inhibit-startup-message t)
(setq grep-program "egrep")
(setq-default fill-column 72)
;; With numeric ARG, display the tool bar if and only if ARG is
;; positive. Tool bar has icons document (read file), folder (read
;; directory), X (discard buffer), disk (save), disk+pen (save-as),
;; back arrow (undo), scissors (cut), etc.
(tool-bar-mode 0)
;; Get rid of the annoying splash and startup screens
(setq inhibit-splash-screen t
inhibit-startup-message t)
(setq grep-program "egrep")
(setq-default fill-column 72)
@mattdeboard
mattdeboard / it_follows.py
Last active January 19, 2017 17:48
Simulation of the plot of It Follows
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
#!/usr/bin/env python
import os
import random
class Follower:
def __init__(self, starting_location, current_victim=None):
# `starting_location` is a string representing a file system path.
self.location = starting_location
self.current_victim = current_victim
@mattdeboard
mattdeboard / .dir-locals.el
Created January 9, 2017 22:25
This is the right variable to override for jedi in emacs to make Jedi understand where the darn virtualenv lives.
;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")
((python-mode
(python-shell-virtualenv-path . "/Users/mdeboard/Envs/sumo")))
;; Version 1
{:user {:plugins [[luminus/lein-template "2.9.10.74"]]}
:repl {:dependencies [[cider/cider-nrepl "0.15.0-snapshot"]]}}
;; Version 2
{:user {:plugins [[luminus/lein-template "2.9.10.74"]]
:dependencies [[cider/cider-nrepl "0.15.0-snapshot"]]}}
;; Running `clojure-jack-in' here
(ns guestbook.db.core
(:require
[conman.core :as conman]
[mount.core :refer [defstate]]
[guestbook.config :refer [env]]))
(defstate ^:dynamic *db*
:start (conman/connect!
{:datasource
guestbook.db.core> (require '[guestbook.core :refer :all])
nil
guestbook.db.core> (mount.core/start #'*db*)
ClassCastException mount.core.DerefableState cannot be cast to clojure.lang.IFn guestbook.db.core/eval4338/fn--4339 (core.clj:11)
guestbook.db.core>
require('normalize.css/normalize.css');
require('styles/App.css');
require('codemirror/lib/codemirror.css');
import React from 'react';
import Paste from './Paste';
import LanguageStore from '../stores/LanguageStore';
import Constants from '../AppConstants';
import { codemirror } from '../../cfg/base.js';