This file contains hidden or 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
module SimpleHashtag | |
class Hashtag < ActiveRecord::Base | |
acts_as_tenant :tenant | |
def self.find_by_name(name, tenant) | |
Hashtag.where("lower(name) =? AND tenant_id=?", name.downcase, tenant.id).first | |
end | |
def self.find_or_create_by_name(name, tenant, &block) | |
find_by_name(name, tenant) || create(name: name, &block) |
This file contains hidden or 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
#!/usr/bin/env ruby | |
#coding: utf-8 | |
require 'pp' | |
word = {} | |
tweets = [] | |
final = {} | |
File.open("mapreduce.csv", "r:windows-1251:utf-8").each_line do |line| | |
line = line.split(",") | |
word[line[0]] = line[2] |
This file contains hidden or 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
Salut Mathieu. j'ai trouvé ton code dans dans les exemples pour un find by username. | |
Si je veux l'adapter pour créer une méthode de login, est-ce que quelque chose de genre marcherait ? | |
Je suis pas sûr de bien comprendre la l.9 | |
def login(name: String, password: String): Future[Option[People]] = { | |
val query = new Query().setIncludeDocs(true).setLimit(1) | |
.setRangeStart(ComplexKey.of(name), ComplexKey.of(password)) | |
.setRangeEnd(ComplexKey.of(s"$name\uefff"), ComplexKey.of(s"password\uefff")) | |
bucket.find[People]("people", "by_name", "by_password")(query).map(_.headOption) | |
} |
This file contains hidden or 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
val headers_13 = Map( | |
"Accept" -> """*/*""", | |
"Origin" -> """http://site.com""", | |
"token" -> """token""" | |
) | |
val scn = scenario("Scenario Name") | |
.exec(http("request_1") | |
.post("http://site.com/login") | |
.headers(headers_1) |
This file contains hidden or 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
// ./jobs//jobs/TweetsCrawl.js | |
var CronJob = require('cron').CronJob; | |
module.exports = function(client, T, io){ | |
var personalSpace = {}; | |
personalSpace.tweetCount = null; | |
personalSpace.twitterStream = null; |
This file contains hidden or 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
Firefly | |
"Dead or Alive" | |
Episode # : 1AGE06 | |
Story # : | |
Written by : Cheryl Cain | |
Directed by : Marita Grabiak |
This file contains hidden or 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> | |
<title>OpenLayers Test</title> | |
<style type="text/css"> | |
html, body, #basicMap { | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
} |
This file contains hidden or 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
computer = #path to movies directory | |
hd = #path to movies directory | |
def get_movies(path_comp, path_hd) | |
# Return ana rray with only the new movies. I exclude the directory Series in the search | |
return `ls #{path_comp} | grep -v Series`.split(/\n/) - `ls #{path_hd} | grep -v Series`.split(/\n/) | |
end | |
new_movies_list = get_movies(computer, hd) |
This file contains hidden or 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
require 'trollop' | |
opts = Trollop.options do | |
banner <<-EOS | |
This programs help you to do a running order. Use it like this: | |
ruby lineup.rb -b Band "Best Band Ever" -t 30 75 -e 21 25 -s 20 | |
Band | |
Set: 21:25 - 21:55 |
This file contains hidden or 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
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:364: warning: already initialized constant Revision | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:365: warning: already initialized constant HTTPVersion | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:369: warning: already initialized constant HAVE_ZLIB | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:677: warning: already initialized constant SSL_ATTRIBUTES | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:1416: warning: already initialized constant HTTPSession | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:2109: warning: already initialized constant METHOD | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:2110: warning: already initialized constant REQUEST_HAS_BODY | |
/Users/username/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:2111: warning: already initialized constant RESPONSE_HAS_BODY | |
/Users/username/.rvm/rub |
NewerOlder