- compile the SendToPort.elm to elm.js
elm-make SendToPort.elm --output elm.js
- open SendToPort.html
class Array | |
# Returns a proc which calls [] with the array's contents as arguments | |
# | |
# ====Usage | |
# [[1, 2], [3, 4], [5, 6]].map(&[0]) | |
# # => [1, 3, 5] | |
# | |
# [{ hello: 'world' }, { hello: 'sun', goodbye: 'moon' }].map(&[:hello]) | |
# # => ['world', 'sun'] |
package main | |
import ( | |
"log" | |
"bufio" | |
"time" | |
"os" | |
"fmt" | |
"io" | |
"net" |
# Elm Sprockets Integration for Rails 3 | |
# | |
# I'm working on turning this into a Gem - see https://github.com/NoRedInk/sprockets-elm - but | |
# I know a lot more about Elm than I do Rails, and haven't gotten that version working yet. | |
# If you know how to help Gemify this, by all means please hit me up! https://twitter.com/rtfeldman | |
# I could definitely use the help. | |
# | |
# Anyway, in the meantime, this is what we're using at NoRedInk to integrate Elm into our asset | |
# pipeline, and it works like a charm. Just copy this into config/initializers/elm_sprockets.rb | |
# |
My largest Sidekiq application had a memory leak and I was able to find and fix it in just few hours spent on analyzing Ruby's heap. In this post I'll show my profiling setup.
As you might know Ruby 2.1 introduced a few great changes to ObjectSpace, so now it's much easier to find a line of code that is allocating too many objects. Here is great post explaining how it's working.
I was too lazy to set up some seeding and run it locally, so I checked that test suite passes when profiling is enabled and pushed debugging to production. Production environment also suited me better since my jobs data can't be fully random generated.
So, in order to profile your worker, add this to your Sidekiq configuration:
if ENV["PROFILE"]
#!/bin/sh | |
# OPTIONAL FLAGS: | |
# | |
# -geoip true | |
# this will install maxmind geoip and auto update crontab file | |
# | |
# -cloudwatch true | |
# this will install aws cloud watch metrics and send them to aws dashboard | |
# |
dependencies: | |
cache_directories: | |
- mongodb-linux-x86_64-2.6.4 | |
pre: | |
- if [[ ! -d mongodb-linux-x86_64-2.6.4 ]]; then wget http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.4.tgz && tar xvzf mongodb-linux-x86_64-2.6.4.tgz; fi | |
- sudo /etc/init.d/mongodb stop | |
- sudo cp mongodb-linux-x86_64-2.6.4/bin/* /usr/bin | |
- sudo /etc/init.d/mongodb start |
<?xml version="1.0"?> | |
<root> | |
<devicevendordef> | |
<vendorname>A4TECH</vendorname> | |
<vendorid>0x09da</vendorid> | |
</devicevendordef> | |
<deviceproductdef> | |
<productname>A4TECH_PC_KB</productname> |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.