Skip to content

Instantly share code, notes, and snippets.

@zonak
zonak / gist:1342498
Created November 6, 2011 05:01
RequireJS combo
# /index.html
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
@zonak
zonak / flush_patch.diff
Created December 17, 2011 03:28
sass output messages flush
diff --git a/lib/sass/exec.rb b/lib/sass/exec.rb
index 60957b2..baeb729 100644
--- a/lib/sass/exec.rb
+++ b/lib/sass/exec.rb
@@ -404,6 +404,7 @@ MSG
raise error unless error.is_a?(::Sass::SyntaxError) && !@options[:stop_on_error]
had_error = true
puts_action :error, :red, "#{error.sass_filename} (Line #{error.sass_line}: #{error.message})"
+ STDOUT.flush
end
@zonak
zonak / sample.js
Created April 5, 2012 17:48
jQuery mobile issue with r.js optimization
// Spot A
window.document.onmobileinit = function() {
// this happens in both regular and optimized version
$.mobile.ajaxEnabled = false;
$.mobile.hashListeningEnabled = false;
$.mobile.pushStateEnabled = false;
$.mobile.linkBindingEnabled = false;
};
require.config({
@zonak
zonak / grunt_watch_usage.md
Created April 9, 2012 20:08
A usage scenario of the extended version of grunt.file.expandFiles

A usage scenario of the extended version of grunt.file.expandFiles that has the added feature of providing lists of:

  • all - set of all files matching the src definition of the task (default option)
  • changed - set of files matching the src definition of the task that have been changed since the last iteration of the watch task
  • deleted - set of files matching the src definition of the task that have been deleted since the last iteration of the watch task

The task execution would go something like this:

  • check for changed files:
@zonak
zonak / grunt_common_path.js
Created April 11, 2012 15:41
grunt helper for finding the longest common path
grunt.registerHelper('commonPath', function(inFiles) {
var results = [],
minLen = 99,
isValid,
dirs;
dirs = inFiles.map(function(filepath) {
var tmpArr = path.dirname(filepath).split('/');
if(tmpArr.length < minLen) {
@zonak
zonak / grunt-coffee.js
Created April 13, 2012 02:46
grunt task for compiling CoffeScript
/*
* Grunt Task File
* ---------------
*
* Task: coffee
* Description: Compile CoffeeScript files
* Dependencies: coffee-script
*
*/
<?xml version="1.0" encoding="utf-8" ?>
<Driver xmlns="http://code.google.com/p/open-zwave/" version="3" home_id="0x016a318c" node_id="1" api_capabilities="0" controller_capabilities="8" poll_interval="30000" poll_interval_between="0">
<Node id="1" name="" location="" basic="2" generic="2" specific="1" type="Static PC Controller" listening="true" frequentListening="false" beaming="true" routing="false" max_baud_rate="40000" version="3" query_stage="Complete">
<Manufacturer id="0086" name="Aeon Labs">
<Product type="0002" id="0001" name="Z-Stick S2" />
</Manufacturer>
<CommandClasses>
<CommandClass id="32" name="COMMAND_CLASS_BASIC" version="1" after_mark="true">
<Instance index="1" />
<Value type="byte" genre="all" instance="1" index="0" label="Basic" units="" read_only="false" write_only="false" verify_changes="false" poll_intensity="0" min="0" max="255" value="0" />
@zonak
zonak / full_ozw.log
Created October 30, 2013 19:25
OZW configuration and logs after adding Aeon Labs Smart Energy Switch
2013-10-30 19:12:56.647 mgr, Added driver for controller /dev/ttyUSB0
2013-10-30 19:12:56.661 Opening controller /dev/ttyUSB0
2013-10-30 19:12:56.664 Trying to open serial port /dev/ttyUSB0 (attempt 1)
2013-10-30 19:12:56.673 Serial port /dev/ttyUSB0 opened (attempt 1)
2013-10-30 19:12:56.677 contrlr, Queuing (Command) FUNC_ID_ZW_GET_VERSION: 0x01, 0x03, 0x00, 0x15, 0xe9
2013-10-30 19:12:56.679 contrlr, Queuing (Command) FUNC_ID_ZW_MEMORY_GET_ID: 0x01, 0x03, 0x00, 0x20, 0xdc
2013-10-30 19:12:56.680 contrlr, Queuing (Command) FUNC_ID_ZW_GET_CONTROLLER_CAPABILITIES: 0x01, 0x03, 0x00, 0x05, 0xf9
2013-10-30 19:12:56.682 contrlr, Queuing (Command) FUNC_ID_SERIAL_API_GET_CAPABILITIES: 0x01, 0x03, 0x00, 0x07, 0xfb
2013-10-30 19:12:56.684 contrlr, Queuing (Command) FUNC_ID_ZW_GET_SUC_NODE_ID: 0x01, 0x03, 0x00, 0x56, 0xaa
2013-10-30 19:12:56.686
@zonak
zonak / example.js
Created November 18, 2013 14:20
Ember params
/*
DEBUG: -------------------------------
DEBUG: Ember : 1.2.0-beta.3
DEBUG: Ember Data : 1.0.0-beta.2
DEBUG: Handlebars : 1.1.2
DEBUG: jQuery : 1.9.1
DEBUG: -------------------------------
*/
// ...