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
| const puppeteer = require('puppeteer-core'); | |
| (async () => { | |
| // connect to the dockerised chrome | |
| const browser = await puppeteer.connect({ | |
| browserURL: 'http://docker.for.mac.localhost:9222' | |
| }); | |
| const page = await browser.newPage(); | |
| await page.goto('https://github.com/puppeteer/puppeteer', { waitUntil: 'networkidle2' }); | |
| await page.screenshot({ path: 'screenshots/example.png' }); |
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 | |
| class StripTag implements Replacement { | |
| private $tagName; | |
| public function __construct( string $tagName ) { | |
| $this->tagName = $tagName; | |
| } | |
| public function replace( string $html ) : string { |
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
| import os.path | |
| import shutil | |
| directory = '.' | |
| backup_directory = '_archives' | |
| to_skip = [] | |
| def should_be_archived(file): | |
| if not os.path.isdir(file): | |
| return False |
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
| quicksort [] = [] | |
| quicksort (pivot:tail) = sorted_less ++ [pivot] ++ sorted_greater | |
| where | |
| sorted_less = quicksort [x | x <- tail, x <= pivot] | |
| sorted_greater = quicksort [x | x <- tail, x > pivot] | |
| main = do | |
| putStrLn "quicksort:" | |
| print $ quicksort [10,9..0] |
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
| from math import log, pow, factorial | |
| def nCr(n,r): | |
| f = factorial | |
| return f(n) / f(r) / f(n-r) | |
| def H(x): | |
| # Shannon entropy / information content | |
| sum = 0.0 |
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
| task body Periodic is | |
| Next_Release : Time; | |
| Next_Deadline : Time; | |
| Period : Time_Span := Milliseconds(500); | |
| Deadline : Time_Span := Milliseconds(10); | |
| begin | |
| loop | |
| select | |
| delay until Next_Dealine; | |
| -- deadline miss recovery code here |
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
| import math | |
| class Node(): | |
| def __init__(self, position, bit_string, bit): | |
| self.position = position | |
| self.bit_string = bit_string | |
| self.bit = bit | |
| self.one = None | |
| self.zero = None | |
| self.pointer = None |
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 combine(x, y): | |
| return x + y | |
| print(combine(2, 4)) |
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
| Array | |
| ( | |
| [0] => PhpParser\Node\Stmt\Function_ Object | |
| ( | |
| [byRef] => | |
| [name] => combine | |
| [params] => Array | |
| ( | |
| [0] => PhpParser\Node\Param Object | |
| ( |
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 | |
| // snippet one | |
| function combine($x, $y) { | |
| return $x + $y; | |
| } | |
| echo combine(2, 4); |
NewerOlder