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
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
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
| var http = require('http'); | |
| function onRequest(client_req, client_res) { | |
| console.log('req: ' + client_req.url); | |
| var options = { | |
| hostname: 'victorwyee.com', | |
| port: 80, | |
| path: client_req.url, | |
| method: 'GET', |
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
| def cosine_similarity(v1, v2): | |
| magnitude1 = np.linalg.norm(v1) | |
| magnitude2 = np.linalg.norm(v2) | |
| if (not magnitude1) or (not magnitude2): | |
| return 0 | |
| return np.dot(v1, v2) / (magnitude1 * magnitude2) |
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
| # Add upstream remote | |
| git remote add upstream https://url/to/repo | |
| # Verify remotes | |
| git remote -v | |
| # Fetch upstream remote's branches | |
| git fetch upstream | |
| # Checkout branch to update (e.g. master) |
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 # to enable highlighting | |
| function register_gist_highlighting() { | |
| wp_register_style( 'gist-highlighting-obsidian', '//victorwyee.github.io/gist-syntax-themes/stylesheets/obsidian.css', false, null, 'all'); | |
| } | |
| function gist_highlighting_obsidian_shortcode() { | |
| wp_enqueue_style( 'gist-highlighting-obsidian' ); | |
| } |
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 exclude_widget_categories($args) { | |
| $exclude = "4, 6, 7, 8, 9, 23, 43, 69"; | |
| $args["exclude"] = $exclude; | |
| return $args; | |
| }; | |
| add_filter("widget_categories_args", "exclude_widget_categories"); |
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 exclude_post_categories($exclude="", $spacer=" ", $id=false){ | |
| // allow for specifiying id in case we want to use the function to bring in | |
| // another pages categories | |
| if(!$id){ | |
| $id = get_the_ID(); | |
| } | |
| $categories = get_the_category($id); // get the categories | |
| $exclude = explode(",",$exclude); // split the exclude string into an array | |
| $result = array(); // define array for storing results | |
| foreach($categories as $cat) { // loop the cats |
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>"; | |
| } |
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]'); ?> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
OlderNewer