// jQuery
$(document).ready(function() {
// code
})
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
@app.route('/post/<id>') | |
@app.route('/post/<id>/<slug>') | |
def view_post(id, slug=None): | |
post = models.Post.query.get_or_404(id) | |
if post.slug != slug: | |
return redirect(url_for('post', id=id,slug = post.slug)) | |
return render_template("post.html", post=post) |
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
from collections import Counter | |
a = {'a': 1} | |
b = {'a': 2, 'b': 3} | |
c = Counter(a) + Counter(b) |
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 time | |
import sys | |
ms = int(sys.argv[1]) if len(sys.argv) > 1 else 250 | |
words, start = 0, time.time() | |
print "\n"*2 | |
try: | |
for line in sys.stdin: |
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
extension UITableView { | |
func reloadDataAnimated(animated:Bool) { | |
reloadData() | |
if animated { | |
let animation = CATransition() | |
animation.type = kCATransitionPush | |
animation.subtype = kCATransitionFromBottom | |
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) |
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
/** | |
* @providesModule PatientList | |
*/ | |
import NavigationBar from 'react-native-navbar'; | |
import NavigationButtons from 'NavigationButtons'; | |
import React, { ListView, Navigator, StyleSheet, Text, TextInput, TouchableHighlight, View } from 'react-native'; | |
import { connect } from 'react-redux/native' | |
@connect(state => ({ | |
patients: state.patients |
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/bash | |
OLD_XCODE_PATH=${1:-/Applications/Xcode7.app} | |
NEW_XCODE_PATH=${2:-/Applications/Xcode.app} | |
IOS_NEW_VERSION=10 | |
DEVICE_SUPPORT_PATH=Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport | |
ln -s $NEW_XCODE_PATH/$DEVICE_SUPPORT_PATH/$IOS_NEW_VERSION.* $OLD_XCODE_PATH/$DEVICE_SUPPORT_PATH/ |
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 tempfile | |
import logging | |
import sentencepiece as spm | |
from typing import List | |
from overrides import overrides | |
from allennlp.common import Params | |
from allennlp.data.tokenizers.token import Token | |
from allennlp.data.tokenizers.tokenizer import Tokenizer |
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 in root directory of your project | |
;; Install pyls in the project environment | |
;; pip install python-language-server | |
((python-mode . ((eval . (progn (require 'lsp-mode) | |
(lsp-register-client | |
(make-lsp-client :new-connection (lsp-tramp-connection "~/miniconda3/envs/znlp/bin/pyls") | |
:major-modes '(python-mode) | |
:remote? t | |
:server-id 'remote-pyls)))) | |
(eval . (setq lsp-clients-python-command '("~/miniconda3/envs/znlp/bin/pyls"))) |
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 csv | |
from typing import Dict, Optional | |
import logging | |
import torch | |
import random | |
from collections import Counter | |
import numpy as np | |
from overrides import overrides | |
from torch.utils.data import Dataset, IterableDataset, DataLoader, DistributedSampler |
OlderNewer