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 os | |
import asynchttpserver | |
import asyncdispatch | |
import strutils | |
import fsnotify | |
proc main {.async.} = | |
var server = newAsyncHttpServer() | |
proc cb(req: Request) {.async.} = |
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
(defun org-babel-execute:nim (body params) | |
"Execute a block of Nim code with org-babel." | |
(message "executing Nim source code block") | |
(let* (in-file (org-babel-temp-file "nim-"))) | |
(with-temp-file in-file | |
(insert body)) | |
(org-babel-eval (format "nim r %s" (org-babel-process-file-name in-file)))) |
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
{ | |
"CallerReference": "glorious.website-cli", | |
"Aliases": { | |
"Quantity": 2, | |
"Items": [ | |
"glorious.website", | |
"www.glorious.website" | |
] | |
}, | |
"DefaultRootObject": "index.html", |
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
tee ./index.html <<EOF | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="/style.css"/> | |
<title>Glorious Website</title> | |
</head> | |
<body> | |
<h1>Version 1</h1> | |
<p>Go to <a href="/blog/first-post">blog/first-post</a></p> | |
</body> |
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
use std::collections::HashMap; | |
struct Cacher<T> | |
where | |
T: Fn(&u32) -> u32, | |
{ | |
calculation: T, | |
values: HashMap<u32, u32>, | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 assert = require("assert") | |
describe("should break", function(){ | |
it("it doesn't", function(){ | |
console.log("foo"); | |
assert.equal(1,1); | |
}); | |
}); |
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 Sequelize = require('sequelize'); | |
var sequelize = new Sequelize('db','db_user','db_password'); | |
var chainer = new Sequelize.Utils.QueryChainer | |
var User = sequelize.define('User', {name: Sequelize.STRING}, {timestamps: false}) | |
var City = sequelize.define('City', {name: Sequelize.STRING}, {timestamps: false}) | |
var joe = User.build({name: 'Joe'}); | |
var london = City.build({name: 'London'}); |
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 Sequelize = require('sequelize'); | |
var sequelize = new Sequelize('db','db_user','password'); | |
var chainer = new Sequelize.Utils.QueryChainer | |
// define models | |
var User = sequelize.define('User', {name: Sequelize.STRING}) | |
// build instances | |
var joe = User.build({name: 'Joe'}); | |
var jane = User.build({name: 'Jane'}); |
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 Sequelize = require('sequelize'); | |
var sequelize = new Sequelize('db', 'user', 'password'); | |
var Person = sequelize.define('Person', { | |
name: Sequelize.STRING, | |
}); | |
var ChildrenPerson = sequelize.define('ChildrenPerson', { | |
PersonId: { |
NewerOlder