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
import weakref | |
from eventsourcing.application import Application | |
from eventsourcing.persistence import Transcoding, Transcoder | |
from dataclasses import asdict | |
from dacite import from_dict | |
class DataClassAsDict (Transcoding): | |
""" |
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
import os | |
import patreon | |
import requests | |
from dotenv import load_dotenv | |
load_dotenv() | |
access_token = os.environ.get('PATREON_ACCESS_TOKEN') |
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
<?php | |
$db = new PDO('sqlite::memory:'); | |
$db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); | |
$db->setAttribute( PDO::ATTR_CASE, PDO::CASE_LOWER ); | |
$db->setAttribute( PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC ); | |
$db->exec("CREATE TABLE users (id INTEGER PRIMARY KEY NOT NULL, username TEXT NOT NULL)") . "\n"; |
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
#!/bin/sh | |
# dict-password.sh | |
# Harlan Iverson <[email protected]> | |
# Generate words on the CLI like XKCD #936 -- http://xkcd.com/936/ | |
# usage: DICT=/usr/share/dict/words COUNT=4 ASK=y ./dict-password.sh > newpass | |
# or simply: ./dict-password.sh |
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
MongoTemplate mongo = ...; | |
List<Converter> converters = new ArrayList<Converter>(); | |
converters.add(new Converter<DBObject, Participant>() { | |
public Participant convert(DBObject s) { | |
throw new UnsupportedOperationException("Not supported yet 1."); | |
} | |
}); | |
converters.add(new Converter<Participant, DBObject>() { |
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
// http://www.mongodb.org/display/DOCS/Multikeys | |
// Embedded object fields in an array | |
db.testnest.insert({"title" : "How the west was won", | |
"comments" : [{"text" : "great!" , "author" : "sam"}, | |
{"text" : "ok" , "author" : "julie"}], | |
"_id" : ObjectId("497ce79f1ca9ca6d3efca325")}); | |
// Tried both of these indexes | |
//db.testnest.ensureIndex({'comments.author': 1}, {unique: 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
harlan@plato:/tmp/scalamixin$ javap MyProject | |
Compiled from "mixin.scala" | |
public class MyProject extends BasicProject implements QUnitSupport,scala.ScalaObject{ | |
public scala.collection.immutable.List qunitSources(); | |
public void QUnitSupport$_setter_$qunitSources_$eq(scala.collection.immutable.List); | |
public void qunitRun(); | |
public scala.collection.immutable.List jsSources(); | |
public void JavascriptSupport$_setter_$jsSources_$eq(scala.collection.immutable.List); | |
public MyProject(ProjectInfo); | |
} |
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
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |
http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<!-- 1. --> | |
<groupId>com.example</groupId> | |
<artifactId>my-library</artifactId> |
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>My Sample Project</title> | |
<script src="scripts/require.js"></script> | |
<!-- This require() call will load project.js --> | |
<script>require(["project"]);</script> | |
</head> | |
<body> | |
<h1>My Sample Project</h1> |