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
| package rxexamples; | |
| import rx.schedulers.Schedulers; | |
| import java.io.IOException; | |
| import java.util.Arrays; | |
| import java.util.HashMap; | |
| import java.util.List; | |
| import java.util.Map; |
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
| # backup | |
| docker run --volumes-from mongodata -v $(pwd):/backup busybox tar cvf /backup/backup.tar /data/db | |
| # restore | |
| docker run --volumes-from mongodata -v $(pwd):/backup busybox tar xvf /backup/backup.tar | |
| # Dockerfile | |
| FROM centos |
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/local/bin/node | |
| var assert = require('assert') | |
| function Animal (name) { | |
| this.name = name; | |
| } | |
| assert.equal(new Animal("animal").constructor, Animal) | |
| assert.equal(new Animal("animal") instanceof Animal, true) |
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/local/bin/node | |
| var assert = require('assert') | |
| function foo () { | |
| return "foobar"; | |
| } | |
| eval("var bar = " + foo.toString()) |
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/local/bin/node | |
| var assert = require("assert") | |
| function talk (who) { | |
| return this.name + " is talking with " + who | |
| } | |
| var michael = { | |
| name : "michael" | |
| } |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <sys/types.h> | |
| #include <sys/socket.h> | |
| #include <netinet/in.h> | |
| #include <netdb.h> | |
| #include <sys/select.h> |
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
| #include <stdio.h> | |
| struct greet_api | |
| { | |
| int (*say_hello)(char *name); | |
| int (*say_goodbye)(void); | |
| }; | |
| int say_hello_fn(char *name) { | |
| printf("Hello %s\n", name); |
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
| package main | |
| import ( | |
| "bufio" | |
| "net" | |
| ) | |
| type Client struct { | |
| incoming chan string | |
| outgoing chan string |
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
| def rota(people): | |
| _people = list(people) | |
| current = 0 | |
| while len(_people): | |
| command = yield _people[current] | |
| current = (current + 1) % len(_people) | |
| if command: | |
| comm, name = command | |
| if comm == "add": | |
| _people.append(name) |
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
| def rota(people): | |
| _people = list(people) | |
| current = 0 | |
| while len(_people): | |
| yield _people[current] | |
| current = (current + 1) % len(_people) | |
| if __name__ == "__main__": | |
| people = ["Ant", "Bernard", "Carly", "Deb", "Englebert"] | |
| r = rota(people) |