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
<%# Put this code snippet between the <head></head>-tags in your application layout and %> | |
<%# replace 'UA-XXXXXXXX-X' with your own unique Google Analytics Tracking ID %> | |
<%# ... %> | |
<head> | |
<%# ... %> | |
<% if Rails.env.production? %> | |
<script type="text/javascript"> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
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 testimonials = document.querySelectorAll('img.main-photo'); | |
Array.prototype.forEach.call(testimonials, function(element, index) { | |
console.log(element.src); | |
}); |
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 torch | |
from collections import OrderedDict | |
def rename_state_dict_keys(source, key_transformation, target=None): | |
""" | |
source -> Path to the saved state dict. | |
key_transformation -> Function that accepts the old key names of the state | |
dict as the only argument and returns the new key name. | |
target (optional) -> Path at which the new state dict should be saved |
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 torch | |
def confusion(prediction, truth): | |
""" Returns the confusion matrix for the values in the `prediction` and `truth` | |
tensors, i.e. the amount of positions where the values of `prediction` | |
and `truth` are | |
- 1 and 1 (True Positive) | |
- 1 and 0 (False Positive) | |
- 0 and 0 (True Negative) |
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
#!/bin/sh | |
# Assigns stdin to keyboard - otherwise we're not able to listen to user input below. | |
exec < /dev/tty | |
message_prefix="[GIT HOOK | pre-commit]" | |
echo "$message_prefix Running clippy." | |
if ! cargo clippy | |
then |