First, learn JSON. It's not programming language, not even close. Just follow syntax rules and you will be fine.
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
# Helper functions for publishing events, generating JWT tokens, and generating the Hub URL. | |
def publish_event(event_type, topic, targets): | |
""" | |
Publishes an event to the Mercure Hub. | |
event_type: The type of the event, can be any string | |
topic: The topic the event will be sent to. Only subscribers who request this topic will get notified. | |
targets: The targets that are eligible to get the event. | |
""" | |
token = get_jwt_token([], targets) |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
<style> | |
body { | |
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
Promise.prototype.finally = function (callback) { | |
return this.then( | |
value => this.constructor.resolve(callback()).then(() => value), | |
reason => this.constructor.resolve(callback()).then(() => { throw reason }) | |
) | |
} |
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
let image = UIImage(named: "example") | |
let instagramURL = NSURL(string: "instagram://app") | |
if UIApplication.sharedApplication().canOpenURL(instagramURL!) { | |
let documentsPath = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0] | |
let saveImagePath = (documentsPath as NSString).stringByAppendingPathComponent("Image.igo") | |
let imageData = UIImagePNGRepresentation(image!) | |
do { | |
try imageData?.writeToFile(saveImagePath, options: NSDataWritingOptions(rawValue: 0)) | |
} catch { | |
print("Instagram sharing error") |
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
copied from https://devcenter.heroku.com/articles/ssl-certificate-self | |
install go and openssl | |
mac os x: brew install go openssl | |
Generate private key and certificate signing request | |
openssl genrsa -des3 -passout pass:x -out server.pass.key 2048 | |
openssl rsa -passin pass:x -in server.pass.key -out server.key |
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
// class | |
class ClassCar { | |
drive () { | |
console.log('Vroom!'); | |
} | |
} | |
const car1 = new ClassCar(); | |
car1.drive(); |
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 THREE from "lib/three"; | |
const params = ` | |
varying vec2 vUv; | |
uniform vec2 offset; | |
uniform vec2 repeat; | |
uniform sampler2D texture; | |
uniform vec3 color; | |
` |
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
#################################################################### | |
## Copyright(c) Oracle Corporation 1998,2008. All rights reserved.## | |
## ## | |
## Specify values for the variables listed below to customize ## | |
## your installation. ## | |
## ## | |
## Each variable is associated with a comment. The comment ## | |
## can help to populate the variables with the appropriate ## | |
## values. ## | |
## ## |
NewerOlder