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
db.posts.insert({ | |
title: "A MongoDB article", | |
content: "...", | |
author: { | |
name: "Alvise Susmel", | |
email: "[email protected]" | |
}, | |
tags: ["mongodb", "nosql"] | |
}); |
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
for(i=0; i < 10; ++i) { | |
db.posts.insert({ | |
_id: i, | |
title: "Article number "+i | |
}); | |
} |
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
#import "PopOverTestowyViewController.h" | |
#import "FPPopoverController.h" | |
-(IBAction)otwieramPopover:(id)sender{ | |
//SAFE_ARC_RELEASE(popover); popover=nil; | |
//You have set "testController" as the identifier of your PopOverTestowyViewController in storyboard | |
PopOverTestowyViewController *mojController=[self.storyboard instantiateViewControllerWithIdentifier:@"testController"]; | |
//mojController.delegate = self; | |
FPPopoverController *popover=[[FPPopoverController alloc]initWithViewController:mojController]; |
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 import | |
params[:import] | |
begin | |
Learner.import(params[:file], current_user) | |
rescue Exception => e | |
render json: e and return | |
end | |
redirect_to groups_path, notice: "Successfully imported!" | |
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
var url, contentType; | |
casper.start(....) | |
//download time | |
//waitForResource because sometime the server is redirecting multiple time | |
//the browser, so we need the final url to download it as pdf (or render it as html) | |
.waitForResource(function testResource(resource) { | |
console.log("resource: "+resource.status+" : "+resource.contentType+" : "+resource.url); | |
if(resource.status == 200) { | |
url = resource.url; |
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
defmodule Twitter do | |
def start(_type, _args) do | |
import Supervisor.Spec | |
workers = [ | |
worker(Twitter.Producer, ["#Rio2016"]), | |
worker(Twitter.Consumer, [], id: 1), | |
worker(Twitter.Consumer, [], id: 2), | |
worker(Twitter.Consumer, [], id: 3) |
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
{:ok, p} = Producer.start_link | |
children = [ | |
worker(ProducerConsumer, [:pc_1], id: 1), | |
worker(ProducerConsumer, [:pc_2], id: 2) | |
] | |
{:ok, sup} = Supervisor.start_link children, strategy: :one_for_one | |
{:ok, consumer} = Consumer.start [:pc_1, :pc_2] |
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
{:ok, p} = Producer.start_link | |
workers_num = 20 | |
workers = Enum.map(1..workers_num, fn (n)-> | |
worker(ProducerConsumer, [worker_name(n)], id: n) | |
end) | |
worker_names = Enum.map 1..8, &worker_name/1 | |
#consumer subscribes to the producer names passed | |
consumers = [worker(Consumer, [worker_names])] |
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
<html> | |
<head> | |
<title>MaxMind GeoIP test</title> | |
<script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.0/geoip2.js"></script> | |
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.1.min.js"></script> | |
</head> | |
<body> | |
<h1>Loading...</h1> | |
<script type="text/javascript"> | |
$(document).ready(function(){ |
OlderNewer