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
#!/usr/bin/env gjs | |
const { GLib, GUPnP } = imports.gi; | |
const { MainLoop } = GLib; | |
const mainloop = new MainLoop(null, true); | |
function getExternalIpAddress() { | |
// does it work with interface: null or without |
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 {AppState} from 'react-native'; | |
import xml from './xmpp/packages/xml'; | |
// https://xmpp.org/extensions/xep-0352.html | |
// https://facebook.github.io/react-native/docs/appstate | |
module.exports = function csi({entity}) { | |
let supported = false; | |
let inactive = 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
function fixedEncodeURIComponent(str) { | |
return encodeURIComponent(str).replace(/[!'()*]/g, (c) => { | |
return `%${c.charCodeAt(0).toString(16)}`; | |
}); | |
} | |
function urlEncode(params) { | |
let data = ''; | |
Object.keys(params).forEach((key, idx, { length }) => { | |
const k = fixedEncodeURIComponent(key.toString()); |
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
<!-- OUT --> | |
<iq to="localhost" type="set" id="40924263533590377" xmlns="jabber:client"> | |
<bind xmlns="urn:ietf:params:xml:ns:xmpp-bind"/> | |
</iq> | |
<!-- IN --> | |
<iq id="40924263533590377" type="error" xmlns="jabber:client" from="localhost"> | |
<error type="cancel"> | |
<service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/> | |
</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
// global will refer to global for Node.js and window for browsers | |
;(function (global) { // ; in case the file is concatenated with a non ; line ending | |
'use strict' | |
// your code | |
}(typeof global !== 'undefined' ? global : this)) // `this`doesn't refer to global in Node.js module |
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
# EditorConfig is awesome: http://EditorConfig.org | |
root = true | |
[*] | |
end_of_line = lf | |
insert_final_newline = true | |
charset = utf-8 | |
trim_trailing_whitespace = true | |
indent_style = space |
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
/* | |
A simple new-line delimited JSON protocol with upgrades. | |
Receiving Usage: | |
protocol = require('./frame-protocol'); | |
// parsing data | |
parser = protocol.Parser(); |
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 lang="en"> | |
<head> | |
<meta charset="UTF-8"/> | |
<title>TITLE</title> | |
<meta name="description" content="$DESCRIPTION"> | |
<meta name="author" content="$AUTHOR"> | |
<meta name="keywords" content="$KEYWORDS"> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<!doctype html> | |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"> | |
<head> | |
<meta charset="UTF-8"/> | |
<title>TITLE</title> | |
<meta name="description" content="$DESCRIPTION"/> | |
<meta name="author" content="$AUTHOR"/> |
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
// This code co-ordinates tabs from the same domain to elect one of them as a | |
// "master", and allow them to broadcast messages to each other. | |
function WindowController () { | |
var now = Date.now(), | |
ping = 0; | |
try { | |
ping = +localStorage.getItem( 'ping' ) || 0; | |
} catch ( error ) {} | |
if ( now - ping > 45000 ) { | |
this.becomeMaster(); |
NewerOlder