Skip to content

Instantly share code, notes, and snippets.

View jamilnyc's full-sized avatar
📓
Studying

Murshed J. Ahmed jamilnyc

📓
Studying
View GitHub Profile
@jamilnyc
jamilnyc / json_saver.python
Last active May 23, 2021 00:08
A simple python script for sequentially fetching URL's, parsing their JSON response and writing them to files.
#!/usr/bin/python3
import json
import requests
from pathlib import Path
import sys
class bcolors:
"""
Color codes for the command line
<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>
@jamilnyc
jamilnyc / jscroll_example.js
Created July 23, 2016 03:59
Configuring an Infinite Scroll Container with JScroll
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 () {
@jamilnyc
jamilnyc / thumbnail.js
Created July 23, 2016 03:55
Create a thumbnail from a PDF in Node
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) {