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 self.order(ids) | |
# The postgresql way | |
update_all(["position = STRPOS(?, ','||id||',')", ",#{ids.join(',')},"]) | |
# the mysql way | |
# update_all(['position = FIND_IN_SET(id, ?)', ids.join(',')]) | |
end |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"> | |
<title>Albers Projection</title> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/d3/2.8.1/d3.v2.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<style type="text/css"> |
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
RSpec::Matchers.define :have_tracked do |event_name| | |
match do |backend| | |
@event_name = event_name | |
@backend = backend | |
if @match_user && @properties | |
backend.tracked_events_for(@match_user).named(@event_name).has_properties?(@properties) | |
elsif @properties | |
backend.tracked_events.named(@event_name).has_properties?(@properties) | |
elsif @match_user | |
backend.tracked_events_for(@match_user).named(@event_name).events.any? |
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
apt-get -y update | |
apt-get -y build-dep build-essential | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libffi-dev libxslt1-dev libxml2-dev | |
cd /tmp | |
curl -s -L http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz | tar xzv | |
cd `ls | grep -m 1 ruby-` | |
./configure --prefix=/usr/local --disable-install-rdoc | |
make | |
make install |