Skip to content

Instantly share code, notes, and snippets.

View rmehner's full-sized avatar
🤷‍♀️
¯\_(ツ)_/¯

Robin Mehner rmehner

🤷‍♀️
¯\_(ツ)_/¯
View GitHub Profile
.DS_Store
node_modules
var sinon = require('sinon');
var assert = require('assert');
var simpleObject = {
greet: function() {
return 'hello world';
}
};
var stub_object = sinon.stub(simpleObject);
#!/bin/bash
# Install the latest Chromium mac nightly build, but only
# if it's different from the currently installed version.
build_url="http://commondatastorage.googleapis.com/chromium-browser-snapshots/Mac"
install_dir="/Applications/Chromium.app"
# Determine the currently installed chromium build number
if [[ -d $install_dir ]]; then
class Song < ActiveRecord::Base
belongs_to :session
validates_presence_of :file_name
validate :file_name_has_to_be_audio
private
def file_name_has_to_be_audio
unless ['mp3', 'flac', 'wav'].include? file_name.split(".").last.downcase
module Archive
class Directory
def initialize(dir)
@directory = dir
end
def sessions
@sessions ||= scan_for_sessions
end
@rmehner
rmehner / jquery.placeholder.js
Created January 13, 2012 13:52
A little placeholder jQuery snippet I've used for years now
jQuery(function($) {
var input = document.createElement('input');
var placeholderSupport = 'placeholder' in input;
// prevent IE from leaking
input = null;
if (placeholderSupport) {
return;
}
diff --git a/js/vendor/pubsub.js b/js/vendor/pubsub.js
index ed8ecc4..b7b81cf 100644
--- a/js/vendor/pubsub.js
+++ b/js/vendor/pubsub.js
@@ -25,61 +25,61 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
/** section: PubSub
* PubSubJS is a dependency free library for doing ['publish/subscribe'](http://en.wikipedia.org/wiki/Publish/subscribe)
* messaging in JavaScript.
- *
- * In order to not have surprising behaviour where the execution chain generates more than one message,
@rmehner
rmehner / typo.patch
Created March 2, 2012 09:44
PubSub typo patch
diff --git a/js/vendor/pubsub.js b/js/vendor/pubsub.js
index ed8ecc4..7d90e2b 100644
--- a/js/vendor/pubsub.js
+++ b/js/vendor/pubsub.js
@@ -28,7 +28,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* In order to not have surprising behaviour where the execution chain generates more than one message,
* publication of messages with PubSub are done asyncronously (this also helps keep your code responsive, by
- * dividing work into smaller chunkcs, allowing the event loop to do it's business).
+ * dividing work into smaller chunks, allowing the event loop to do it's business).
%script
function ohai(msg) {
alert(msg);
}
<script type="text/javascript">
//<![CDATA[
window.foo || document.write('<script src="bla.js"></script>');
//]]>
</script>