Skip to content

Instantly share code, notes, and snippets.

View Downes's full-sized avatar

Stephen Downes Downes

View GitHub Profile
<!-- Reader Tab -->
<li class="nav-item"><span class="nav-link" style="cursor:pointer" data-toggle="modal" data-target="#exampleModal">
<img src="<st_url>assets/icons/grssicon.JPG" border=0 width=20 alt="Open Reader" title="Open Reader"></span></li>
@Downes
Downes / package.json
Created January 13, 2019 21:28
Electron package.json file
{
"name": "m1",
"version": "1.0.0",
"description": "",
"main": "bootstrap.js",
"scripts": {
"build": "rimraf hello-world-* && electron-packager . --out=win --platform=win32 --arch=x64 --overwrite --asar",
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
},
@Downes
Downes / bootstrap.js
Created January 13, 2019 21:41
Electron sample boostrap..js file
// console.log('testing')
const{app,BrowserWindow, Menu} = require('electron')
const ipc = require('electron').ipcMain
// main process
const path = require('path')
const url = require('url')
require('electron-reload')(__dirname)
let win
<webview id="main-webview" src="http://finance.yahoo.com" style="width:500px;height:600px">
<div class="wait-message"></div>
var req = request("http://rss.cnn.com/rss/edition.rss")
req.on('response', function(res){
stream.pipe(feedparser)
})
feedparser.on('error',function(error){
console.log('error in parsing')
})
@Downes
Downes / gist:630c639ca77e01a21782ce2e22b20ad8
Created February 17, 2019 21:32
imdb-scraper-feb2019.js
console.log("---> Running");
const curl = require("curl");
const jsdom = require("jsdom");
const url = "http://www.imdb.com/list/ls004489992/";
curl.get(url, null, (err,resp,body)=>{
if(resp.statusCode == 200){
console.log("Received data")
parseData(body);
@Downes
Downes / ballot.sol
Created August 8, 2019 17:50
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.17+commit.bdeb9e52.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.6.0;
contract Ballot {
struct Voter {
uint weight;
bool voted;
uint8 vote;
address delegate;
}
struct Proposal {
<link href="http://www.mooc.ca/cgi-bin/api.cgi" rel="webmention" />
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Remote Comment Example</title>
<link href="http://www.mooc.ca/cgi-bin/api.cgi" rel="webmention" />
</head>
<body>
<h1>Blog Post</h1>
<p>Here is the text of my blog post. Don't you juyst want to comment?</p>
@Downes
Downes / gist:07ef87d59a16c8e1d3f66b3e9771410a
Created January 30, 2021 23:02
Remote Comment Server Side
# ------- Remote Comment ----------------------------------------------------
sub rcomment {
&record_sanitize_input($vars);
while (my ($vkey,$vval) = each %$vars) {
$vars->{$vkey} =~ s/\0/,/g; # Replace 'multi' delimiter with comma
}
die "Not allowwed to comment" unless (&is_allowed("create",$table));