Find it here: https://github.com/bitemyapp/learnhaskell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns swinger | |
(:import (java.awt BorderLayout Container Dimension)) | |
(:import (javax.swing JButton JFrame JLabel JPanel JTextField JOptionPane JScrollPane JList ImageIcon JComboBox JSeparator JTable UIManager SwingUtilities AbstractButton JFileChooser JDialog JProgressBar JTabbedPane)) | |
(:import (javax.swing.table AbstractTableModel)) | |
(:import (java.awt.event MouseAdapter MouseListener KeyEvent)) | |
(:import (java.awt Toolkit BorderLayout Dimension Color Dialog$ModalityType)) | |
(:use (clojure.contrib | |
[miglayout :only (miglayout components)] | |
[swing-utils :only (add-action-listener add-key-typed-listener make-menubar)]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def x (ref 0) | |
(def agents (for [i (range 0 1000)] (agent x))) | |
(map #(send %1 (fn [x] (dosync (alter x inc)))) agents) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns tetris | |
(:import | |
(javax.swing JFrame) | |
(java.awt Canvas Graphics Color Toolkit) | |
(java.awt.event ActionListener KeyListener KeyEvent)) | |
(:gen-class)) | |
(def *cols* 10) | |
(def *rows* 20) | |
(def *width* 300) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
ActiveRecord::Base.logger = Logger.new(STDERR) | |
ActiveRecord::Base.colorize_logging = false | |
ActiveRecord::Base.establish_connection( | |
:adapter => "sqlite3", | |
:dbfile => ":memory:" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In Chef, when a resource is defined all its variables are evaluated during | |
# compile time and the execution of the resource takes place in converge phase. | |
# So if the value of a particular attribute is changed in converge | |
# (and not in compile) the resource will be executed with the old value. | |
# Example problem: | |
# Let's consider this situation where there are two steps involved in a recipe | |
# Step 1 is a Ruby block that changes a node attribute. Rubyblocks get executed | |
# in converge phase | |
# Step 2 is a Chef resource that makes use of the node attribute that was |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# update-alternative (install) | |
sudo update-alternatives --install /usr/bin/ruby ruby2.0 /opt/rubies/2.0.0-p353/bin/ruby 0 | |
sudo update-alternatives --install /usr/bin/erb erb2.0 /opt/rubies/2.0.0-p353/bin/erb 0 | |
sudo update-alternatives --install /usr/bin/gem gem2.0 /opt/rubies/2.0.0-p353/bin/gem 0 | |
sudo update-alternatives --install /usr/bin/irb irb2.0 /opt/rubies/2.0.0-p353/bin/irb 0 | |
sudo update-alternatives --install /usr/bin/rake rake2.0 /opt/rubies/2.0.0-p353/bin/rake 0 | |
sudo update-alternatives --install /usr/bin/rdoc rdoc2.0 /opt/rubies/2.0.0-p353/bin/rdoc 0 | |
sudo update-alternatives --install /usr/bin/ri ri2.0 /opt/rubies/2.0.0-p353/bin/ri 0 | |
sudo update-alternatives --install /usr/bin/testrb testrb2.0 /opt/rubies/2.0.0-p353/bin/testrb 0 |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ugh.sh | |
# | |
# | |
# Created by Andrew McKnight on 11/27/14. | |
# | |
# UGH: uncrustify git history. | |
# Creates a new branch and cherry picks a range of commits, uncrustifying any modified .h/.m files. |
OlderNewer