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
| class Greeting: | |
| def __init__(self, greeting='hello'): | |
| self.greeting = greeting | |
| def greet(self, name): | |
| return f'{self.greeting}! {name}' | |
| greeting = Greeting('hola') | |
| print(greeting.greet('bob')) |
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
| class BankAccount | |
| attr_reader :balance | |
| def initialize | |
| @balance = 0 | |
| end | |
| def deposit amount | |
| @balance += amount | |
| end |
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
| # Don't do this: | |
| for i in [0, 1, 2, 3, 4, 5]: | |
| print(i**2) | |
| # Do this: | |
| # In Python 2, range returns a list. | |
| # In Python 3, xrange is deprecated. range now returns a generator. | |
| for i in range(6): | |
| print(i**2) |
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
| declare -a elems=( | |
| "a 1" | |
| "b 2" | |
| "c 3 word" | |
| "d 4" | |
| ) | |
| for elem in "${elems[@]}"; do | |
| read -a strarr <<< "$elem" # uses default whitespace IFS | |
| echo ${strarr[0]} ${strarr[1]} ${strarr[2]} |
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 if ( has_post_thumbnail() && ! post_password_required() ) : ?> | |
| <div class="featured-image" style='background-image: url(" <?= get_the_post_thumbnail_url(get_the_ID(), 'full'); ?>");'></div> | |
| <?php endif; ?> |
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
| /* https://github.com/WordPress/gutenberg/issues/8383 */ | |
| figure.is-embed { | |
| position: relative; | |
| width: 100%; | |
| height: 0; | |
| padding-bottom: 56.25%; /*16:9*/ | |
| } | |
| figure.is-embed iframe { |
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
| /** | |
| * Moves row of data to another spreadsheet based on criteria in column 10. | |
| * Each spreadsheet can be a "source" spreadsheet, or the "target" spreadsheet. | |
| * Assumes there as many spreadsheets as there are criteria values, e.g. | |
| * if the criteria are "R", "P", and "D", then there are three spreadsheets | |
| * named "R", "P" and "D". | |
| * Assumes that each spreadsheet has the same structure. | |
| */ | |
| function onEdit(e) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 echo do_shortcode('[shortcode]'); ?> |
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
| function print_to_console($data) { | |
| $output = $data; | |
| if (is_array($output)) | |
| $output = implode(',', $output); | |
| echo "<script>console.log('Debug Objects: " . $output . "' );</script>"; | |
| } |
NewerOlder