Skip to content

Instantly share code, notes, and snippets.

┌────────────────────┬────────┬────────┐
│ TLD │ Count │ % │
├────────────────────┼────────┼────────┤
│ com │ 436494 │ 43.65% │
├────────────────────┼────────┼────────┤
│ org │ 78371 │ 7.84% │
├────────────────────┼────────┼────────┤
│ de │ 51573 │ 5.16% │
├────────────────────┼────────┼────────┤
│ cn │ 37450 │ 3.75% │
@ian
ian / variableHash.js
Last active August 29, 2015 14:25 — forked from bminer/variableHash.js
Generate a variable-length hash of `data` in Node.js
var crypto = require("crypto");
/* variableHash - Generate a variable-length hash of `data`.
Similar to the answer here: http://crypto.stackexchange.com/a/3559/4829
If you want a b-bit hash of the message m, then use the first b bits of AES-CTR(SHA256(m)).
Rather than using the suggested algorithm in the stackexchange answer above, I developed
my own.
I decided to derive AES256 initialization vector and key from the output of SHA256(data).
class MyApp < DripDrop::Node
def action
route :my_server, :websocket_server, 'ws://127.0.0.1:9292'
my_server.on_open do |response|
EM::PeriodicTimer.new(1) do
my_client.send_message(:name => 'time_request') do |response_message|
puts "The time is: #{response_message.body['time']}"
end
end
[431, 440] in /Users/ian/.rvm/gems/ruby-1.9.2-p0@zaarly/gems/activesupport-3.0.4/lib/active_support/callbacks.rb
431 true
432 debugger
433 end
434 end
435
=> 436 # This is used internally to append, prepend and skip callbacks to the
437 # CallbackChain.
438 #
439 def __update_callbacks(name, filters = [], block = nil) #:nodoc:
--- untitled
+++ (clipboard)
@@ -1,6 +1,7 @@
+<%= javascript_include_merged :product_details, :event_details %>
+<%= stylesheet_link_merged :product_details %>
+
<%- content_for :head do -%>
- <%= javascript_include_merged :product_details, :event_details %>
- <%= stylesheet_link_merged :product_details %>
<%= google_maps_include_tags %>
<script type="text/javascript" charset="utf-8">
function submitNextAction() {
$.cocobox.spinner('Saving your event details. Please wait a moment.');
var form = $('#submit_next').get(0).form;
$(form).submit(); // go through jQuery so that Labelify clears the fields
}
</script>
<div style='width:100%'>