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
def dataframe_requires(column_names: List[str]): | |
""" | |
Wraps a function that takes a pandas.DataFrame as its first argument. | |
Ensures that functions wrapped by this can safely assume that the required | |
columns are available. | |
Also ensures that a copy of the given dataframe is used by the function to | |
prevent modifying parent dataframes kept in memory. |
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
def dataframe_requires(column_names: List[str]): | |
""" | |
Wraps a function that takes a pandas.DataFrame as its first argument. | |
Ensures that functions wrapped by this can safely assume that the required | |
columns are available. | |
Also ensures that a copy of the given dataframe is used by the function to | |
prevent modifying parent dataframes kept in memory. |
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
function plot(points, diameter, offset){ | |
var x, y, | |
angle = 0, | |
links = $('nav a'), | |
increase = Math.PI * 2 / points; | |
for (var i=0; i <= points; i++) { | |
x = diameter * Math.cos(angle) + offset | |
y = diameter * Math.sin(angle) + offset | |
angle += increase |
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
// Test for Media Query support | |
mediaQuery = function() { | |
if (window.matchMedia || window.msMatchMedia) { return true; } | |
return false; | |
} | |
// Remove queries. | |
removeMediaQueries = function(css) { | |
if (!mediaQuery()) { | |
while (css.match(/@media/) !== null) { // If CSS syntax is correct there should always be a "@media" str matching a "}\s*}" string |
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
$('.jp-volume-bar').mousedown(function() { | |
var parentOffset = $(this).offset(), | |
width = $(this).width(); | |
$(window).mousemove(function(e) { | |
var x = e.pageX - parentOffset.left, | |
volume = x/width | |
if (volume > 1) { | |
$("#JPID").jPlayer("volume", 1); | |
} else if (volume <= 0) { | |
$("#JPID").jPlayer("mute"); |
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
<?php | |
add_action('pre_get_posts', 'fix_title'); | |
function fix_title(){ | |
global $wp_query; | |
if ( $wp_query->is_post_type_archive && $wp_query->is_tax ) { | |
global $queried_object; | |
$queried_object = get_queried_object(); | |
$queried_object->labels = new stdClass(); | |
$queried_object->labels->name = $queried_object->name; | |
return $queried_object; |
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
class Slice(object): | |
def __init__(self, root, leng): | |
self.root = root # The original word | |
self.leng = leng # How many morphemes should be used as the prefix for the new portmanteau | |
self.morphemes = [] | |
self.output = '' # | |
self.slice() | |
def slice(self): | |
import re |