This file contains 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 { Observable } from 'rx'; | |
import { EventEmitter } from 'events'; | |
import { Map as map } from 'immutable'; | |
// base para crear sockets | |
class Socket extends EventEmitter { | |
constructor(id) { | |
super(id); | |
this.id = id; | |
} |
This file contains 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 asyncThread(fn, ...args) { | |
if (!window.Worker) throw Promise.reject( | |
new ReferenceError(`WebWorkers aren't available.`) | |
); | |
const fnWorker = ` | |
self.onmessage = function(message) { | |
(${fn.toString()}) | |
.apply(null, message.data) | |
.then(result => self.postMessage(result)); |
This file contains 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 { renderToStream } from "@react-pdf/renderer"; | |
import ReactDOMServer from "react-dom/server"; | |
import { EntryContext, Headers, RemixServer, Request, Response } from "remix"; | |
import PDF, { loader } from "./pdfs/my-pdf.server"; | |
async function handlePDFRequest(request: Request, headers: Headers) { | |
// get the data for the PDF | |
let response = await loader({ request, context: {}, params: {} }); | |
// if it's a response return it, this means we redirected | |
if (response instanceof Response) return response; |
This file contains 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 AWS = require("aws-sdk"); | |
const fetch = require("node-fetch"); | |
const crypto = require("crypto"); | |
const slackChannel = process.env.SLACK_CHANNEL_URL; | |
const githubSecret = process.env.WEBHOOK_SECRET; | |
const verifyGitHubSignature = (req = {}, secret = "") => { | |
const sig = req.headers["X-Hub-Signature"]; | |
const hmac = crypto.createHmac("sha1", secret); | |
const digest = Buffer.from( |
This file contains 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
el.set('contentEditable', true) | |
.addEvents({ | |
keydown: function(e){ if (e.key == 'enter') e.preventDefault(); }, | |
keypress: function(e){ if (e.event.which == 0 && e.code == 13) e.preventDefault(); }, | |
blur: function(){ var text = this.get('text'); this.set('text', text); } | |
}); |
This file contains 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
# List users by average and maximum session length. | |
SELECT person, max(client.runtime_ms), avg(client.runtime_ms) | |
FROM item_occurrence | |
GROUP BY 1 | |
ORDER BY 2 DESC | |
# List active date ranges for each deploy. | |
SELECT client.javascript.code_version, min(timestamp), max(timestamp) | |
FROM item_occurrence | |
GROUP BY 1 |
This file contains 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 { Component } from "React"; | |
export var Enhance = ComposedComponent => class extends Component { | |
constructor() { | |
this.state = { data: null }; | |
} | |
componentDidMount() { | |
this.setState({ data: 'Hello' }); | |
} | |
render() { |
This file contains 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
'use strict'; | |
// 1. Revealing Module Pattern | |
var revModule = function (param) { | |
return { | |
// public | |
funk: funk | |
}; | |
// private |
This file contains 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
###SAP Individual Contributor License Agreement | |
Thank you for your interest in contributing to open source software projects (“Projects”) made available by SAP SE or its affiliates (“SAP”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to SAP in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact opensource@sap.com. | |
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions. | |
**Copyright License.** You hereby grant, and agree to grant, to SAP a non-exclusive, perpetual, irrevocable, worldwid |
This file contains 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
// usage: log('inside coolFunc', this, arguments); | |
// paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/ | |
window.log = function(){ | |
log.history = log.history || []; // store logs to an array for reference | |
log.history.push(arguments); | |
arguments.callee = arguments.callee.caller; | |
if(this.console) console.log( Array.prototype.slice.call(arguments) ); | |
}; |
NewerOlder