Skip to content

Instantly share code, notes, and snippets.

@schatteleyn
schatteleyn / osm_test.html
Last active December 6, 2020 12:58
Little tests with OpenStreetMap and Geolocation API
<!DOCTYPE HTML>
<html>
<head>
<title>OpenLayers Test</title>
<style type="text/css">
html, body, #basicMap {
width: 100%;
height: 100%;
margin: 0;
}
@schatteleyn
schatteleyn / Firefly 1x15 ’Dead Or Alive’
Created February 8, 2013 23:24
Firefly 1x15 ’Dead Or Alive’ - Complete Transcript and donate car You don't what could happen, so here's a copy. Original here http://www.whedon.info/article.php3?id_article=8136
Firefly
"Dead or Alive"
Episode # : 1AGE06
Story # :
Written by : Cheryl Cain
Directed by : Marita Grabiak
// ./jobs//jobs/TweetsCrawl.js
var CronJob = require('cron').CronJob;
module.exports = function(client, T, io){
var personalSpace = {};
personalSpace.tweetCount = null;
personalSpace.twitterStream = null;
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)
@schatteleyn
schatteleyn / People.scala
Created October 10, 2013 18:45
find sur plusieurs paramètres
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)
}
#!/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]
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)