Description of what the REST endpoint does.
- GET
| /** | |
| * useScroll React custom hook | |
| * Usage: | |
| * const { scrollX, scrollY, scrollDirection } = useScroll(); | |
| */ | |
| import { useState, useEffect } from "react"; | |
| export function useScroll() { | |
| const [lastScrollTop, setLastScrollTop] = useState(0); |
Description of what the REST endpoint does.
| <html> | |
| <!-- See live at https://codepen.io/paulera/pen/ejGKEr --> | |
| <head> | |
| <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script> | |
| <script> | |
| /** | |
| * Sum elements of an array up to the index provided. | |
| */ |
| NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; | |
| [request setHTTPMethod:@"GET"]; | |
| NSString *url = @"http://localhost:5000/api/updates/"; | |
| if(checksum){ | |
| url = [NSString stringWithFormat:@"%@?checksum=%@", url, checksum]; | |
| } | |
| [request setURL:[NSURL URLWithString:url]]; | |
| [[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *err) { | |
| NSInteger statusCode = [(NSHTTPURLResponse *)response statusCode]; |
| /* | |
| * http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport/26039199#26039199 | |
| */ | |
| function isElementPartiallyInViewport(el) | |
| { | |
| //special bonus for those using jQuery | |
| if (typeof jQuery !== 'undefined' && el instanceof jQuery) el = el[0]; | |
| var rect = el.getBoundingClientRect(); | |
| // DOMRect { x: 8, y: 8, width: 100, height: 100, top: 8, right: 108, bottom: 108, left: 8 } |
| #! /usr/bin/env python | |
| # | |
| # Mixpanel, Inc. -- http://mixpanel.com/ | |
| # | |
| # Python API client library to consume mixpanel.com analytics data. | |
| # | |
| # Copyright 2010-2013 Mixpanel, Inc | |
| # | |
| # Licensed under the Apache License, Version 2.0 (the "License"); | |
| # you may not use this file except in compliance with the License. |
| <?php | |
| /* | |
| * | |
| * Get posts with a standard query | |
| * Include all the meta data in the result | |
| * | |
| */ | |
| function get_posts_with_meta( $args ) { | |
| $query = get_posts($args); |
| [ | |
| { | |
| "author":"Abraham Lincoln", | |
| "quote":"No man has a good enough memory to be a successful liar." | |
| }, | |
| { | |
| "author":"Albert Einstein", | |
| "quote":"When you are courting a nice girl an hour seems like a second. When you sit on a red-hot cinder a second seems like an hour. That's relativity." | |
| }, | |
| { |
]
[Introduction text about the project. This should be a short summary of the project that explains what it is and why anyone should care about it]
[optional image]
[include a bulleted list of any dependencies your project requires. Include links to the dependencies, and additionally links to helpful resources to get up and running with the project's dependencies]
| 'use strict'; | |
| var mockDelay; | |
| var mockError; | |
| var mockResponse = { | |
| status: function () { | |
| return 200; | |
| }, | |
| ok: true, | |
| get: jest.genMockFunction(), |