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
#!/usr/bin/python | |
from random import randint | |
from sys import exit | |
# list of coins containing their weight (2 grams) | |
coins = [2]*7 | |
# insert a different sized coin (1 or 3 grams randomized) | |
newcoin = randint(0,1)*2+1 | |
coins.insert(randint(0,7), newcoin) |
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 getCTNode = function( domElement ) { | |
// Go through all the editable regions of CT | |
var regions = ContentTools.EditorApp.get().regions(); | |
for ( var i in regions ) { | |
// Go through all the children / Element Nodes | |
var children = regions[ i ].children; | |
for ( var k in children ) { | |
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
/** | |
* A collection of functions that extend the capabilities of HTMLString to | |
* manipulate CSS styles. | |
* | |
* This is used by various formatting tools. | |
*/ | |
/* globals HTMLString */ |
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
/*************************************************************************** | |
* Change Bold tool. Instead of just adding a `<b>` tag, | |
* use font-weight styles. | |
***************************************************************************/ | |
ContentTools.Tools.Bold.canApply = function(element, selection) { | |
return ContentTools.Tools.Heading.canApply( element, selection ); | |
}; | |
ContentTools.Tools.Bold.isApplied = function(element, selection) { | |
var from = 0, to = 0, _ref; |
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
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>ContentTools sandbox</title> | |
<link rel="stylesheet" type="text/css" href="sandbox.css"> | |
<link rel="stylesheet" type="text/css" href="../build/content-tools.min.css"> | |
</head> | |
<body> | |
<article class="article"> |
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 BFIGoogleUrl { | |
public static function shorten($url) { | |
if (!function_exists('curl_init')) | |
return $url; | |
$api = 'https://www.googleapis.com/urlshortener/v1/url?'; | |
$data_string = '{"longUrl":"'.$url.'"}'; | |
# Initialize cURL | |
$ch = curl_init(); |
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
/*! jQuery UI - v1.10.3 - 2013-10-25 | |
* http://jqueryui.com | |
* Includes: jquery.ui.core.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css | |
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=%22Open%20Sans%22%2C%20sans-serif&fwDefault=normal&fsDefault=13px&cornerRadius=0&bgColorHeader=%23333&bgTextureHeader=flat&bgImgOpacityHeader=0&borderColorHeader=%23333&fcHeader=%23eee&iconColorHeader=%23eee&bgColorContent=%23fff&bgTextureContent=flat&bgImgOpacityContent=0&borderColorContent=%23eee&fcContent=%23333333&iconColorContent=%23cccccc&bgColorDefault=%23333&bgTextureDefault=flat&bgImgOpacityDefault=0&borderColorDefault=%23333&fcDefault=%23eee&iconColorDefault=%23eee&bgColorHover=%23222&bgTextureHover=flat&bg |
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 | |
if ( !function_exists( 'bfi_thumb' ) ) { | |
function bfi_thumb() { | |
return BFI_Class_Factory::getNewestVersion( 'BFI_Thumb' )->run(); | |
} | |
} | |
if ( !class_exists( 'BFI_Class_Factory' ) ) { | |
class BFI_Class_Factory { | |
public static $versions = array(); |
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
/** | |
* This snippet will make `is_active_sidebar` work correctly with Custom Sidebars | |
* @author Benjamin Intal | |
*/ | |
/** | |
* Gathers all the sidebar IDs and the replacement IDs. Most of this code froms from CustomSidebarsReplacer->replace_sidebars() | |
*/ | |
add_action( 'cs_predetermineReplacements', 'verdant_custom_sidebars_determine_replacements' ); | |
function verdant_custom_sidebars_determine_replacements( $defaults ) { |
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
<script> | |
// This | |
document.addEventListener( 'DOMContentLoaded', function() { | |
window.dispatchEvent( new CustomEvent( 'resize' ) ); | |
} ); | |
</script> | |
<script> | |
// Or this | |
document.addEventListener( 'DOMContentLoaded', function() { |