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
public class TreeStats { | |
public int depth(Node root) { | |
if (root == null) { | |
return -1; | |
} | |
int leftDepth = depth(root.left); | |
int rightDepth = depth(root.right); | |
return Math.max(leftDepth, rightDepth) + 1; |
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/python3 | |
import json | |
import requests | |
from pathlib import Path | |
import sys | |
class bcolors: | |
""" | |
Color codes for the command line |
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
<h1>Welcome To the Site</h1> | |
<div class="infinite-scroll"> | |
This is a sentence | |
<a class="next-link" href="/path/to/next/page">Link to next page response</a> | |
</div> |
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
console.log('Starting the scrolling script'); | |
$('.infinite-scroll').jscroll({ | |
debug: false, // Show debugging info in console | |
autoTrigger: true, // Start fetching without clicking a "next" link | |
autoTriggerUntil: false, // How many pages to auto trigger until requiring "next" click | |
loadingHtml: '<img src="/images/loading.gif" alt="Loading" />', // What to show when loading responses | |
padding: 20, | |
nextSelector: 'a.next-link:last', // The link with an href to the next response to load | |
callback: function () { |
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 gm = require('gm'); | |
// Create JPG from page 0 of the PDF | |
gm("file.pdf[0]") // The name of your pdf | |
.setFormat("jpg") | |
.resize(200) // Resize to fixed 200px width, maintaining aspect ratio | |
.quality(75) // Quality from 0 to 100 | |
.write("/tmp/cover.jpg", function(error){ | |
// Callback function executed when finished | |
if (!error) { |