Skip to content

Instantly share code, notes, and snippets.

EXPLAIN ANALYZE SELECT count(*) FROM users;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=166.31..166.32 rows=1 width=0) (actual time=1720.265..1720.266 rows=1 loops=1)
-> Foreign Scan on users (cost=100.00..164.61 rows=3413 width=0) (actual time=2.437..1606.006 rows=118069 loops=1)
Total runtime: 1722.674 ms
(3 rows)
Failure/Error: GithubProfile.for_username('mdeiters')
NoMethodError:
undefined method `keys' for nil:NilClass
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security/sanitizer.rb:19:in `debug_protected_attribute_removal'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security/sanitizer.rb:12:in `sanitize'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/activemodel-3.2.21/lib/active_model/mass_assignment_security.rb:230:in `sanitize_for_mass_assignment'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:25:in `block in process_attributes'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:193:in `with_mass_assignment'
# /home/vagrant/.rvm/gems/ruby-2.1.5@coderwall/gems/mongoid-3.1.6/lib/mongoid/attributes/processing.rb:22:in `process_attributes'
@nicolasiensen
nicolasiensen / engaged_users.sql
Last active August 29, 2015 14:17
Most engaged users
SELECT first_name, last_name, email, count(*) AS activities_count
FROM users
JOIN activities
ON activities.user_id = users.id
GROUP BY users.id, users.first_name, users.last_name, users.email
HAVING count(*) > 4
LIMIT 750
class OrganizationCreator
# TODO: add avatar, email_signature_html, bio and facebook_page_uid
def self.create_all
create_meu_recife
create_minha_blumenau
create_minha_campinas
create_minha_curitiba
create_minha_garopaba
create_minha_ouro_preto
# require "~/Desktop/wordpress_parser.rb"
# parser = WordpressParser.new("/Users/nicolasiensen/Desktop/quintal.wordpress.2015-03-03.xml")
# posts = parser.posts
# posts.each_with_index {|post, i| puts i; parser.create_post post }
require 'nokogiri'
class WordpressParser
def initialize file_path = "quintal.wordpress.2015-03-03.xml"
@xml = Nokogiri::XML(File.open(file_path))
<html>
<head>
<title>ao vivo </title>
<!--JS JW6-->
<script type="text/javascript" src="http://a123.g.akamai.net/f/123/214238/1d/214258g.download.akamai.com/214238/_player/jwplayer6/6_9/jwplayer.js" ></script>
<script type="text/javascript">jwplayer.key = "ZfKOArQz+u1vxoCkwM9cihPjTUoVodJwgUCFZRpZLis=";</script>
</head>
<body>
<div id="dPlayer">
<div class="dTitulo_video"></div>
// This helper is required to test any component that renders material-ui components.
// If you are getting a message saying:
// 'undefined is not an object (evaluating this.context.muiTheme.prepareStyles)'
// you should use this helper.
// The usage is simple, you pass a component class to extendComponentWithMUITheme
// and it will return a new component class capable of rendering material-ui
// components
// const MyExtendedComponent = extendComponentWithMUITheme(MyComponent)
@nicolasiensen
nicolasiensen / test-material-ui-event-simulation.js
Created December 20, 2016 11:38
Simulating events with Jest and Material UI
// Simulating clicks
const dashboardMount = mount(
<Dashboard />, {
context: { muiTheme },
childContextTypes: { muiTheme: React.PropTypes.object }
}
)
const menuButton = ReactDOM.findDOMNode(dashboardMount.find(AppBar).find(IconButton).find('button').node)
TestUtils.Simulate.touchTap(menuButton)
hello
world
from
berlin
openapi: 3.0.2
info:
version: 0.0.1
title: Rideshare API
description: |
The Rideshare API provides access to the rideshare service runned by [door2door](https://www.door2door.io/).
# Environments
This API can be consumed in two different environments, staging and production.