Skip to content

Instantly share code, notes, and snippets.

View carlosrberto's full-sized avatar
:octocat:

Carlos Roberto Gomes Junior carlosrberto

:octocat:
View GitHub Profile
<script>alert(123);</script>
<ScRipT>alert("XSS");</ScRipT>
<script>alert(123)</script>
<script>alert("hellox worldss");</script>
<script>alert(“XSS”)</script>
<script>alert(“XSS”);</script>
<script>alert(‘XSS’)</script>
“><script>alert(“XSS”)</script>
<script>alert(/XSS”)</script>
<script>alert(/XSS/)</script>
➜ code-to-graph git:(master) yarn test
yarn run v1.7.0
$ jest
FAIL ./index.test.js
● 1
expect(received).toEqual(expected)
Expected value to equal:
"graph TD
@carlosrberto
carlosrberto / functional_stuffs.js
Created April 21, 2018 15:29
Functional Stuffs 1
const input = document.getElementById('input');
const outPut = document.getElementById('output');
const leftKeys = [
'q', 'w', 'e', 'r', 't',
'a', 's', 'd', 'f', 'g',
'z', 'x', 'c', 'v',
];
const rightKeys = [
@carlosrberto
carlosrberto / haskell.md
Last active June 6, 2018 01:43
Learning Haskell
@carlosrberto
carlosrberto / rbgToHexColor.js
Last active March 28, 2018 21:10
Functional RGB to Hex Color
const fixHex = v => v.length === 1 ? `0${v}` : v;
const decToHex = v => {
return fixHex(parseInt(v, 10).toString(16).toUpperCase());
};
// with map
const rgbToHexColor = function() {
return [...arguments].map(decToHex).join('');
}
@carlosrberto
carlosrberto / pi.js
Created March 25, 2018 22:17
Pi Calculation With JavaScript
// low perf
const fn = n => Math.pow(-1, n)/(2*n + 1);
const sum = (a, b) => a + b;
const range = (n) => {
let i = 0;
let numbers = [];
while(i < n) {
numbers.push(i);
i++;
@carlosrberto
carlosrberto / curry.js
Last active December 14, 2017 01:40
A simple Curry implementation in JavaScript
const curry = function(fn) {
const partial = function(prevArgs = []) {
return function() {
const nextArgs = [...prevArgs, ...arguments];
if((prevArgs.length + arguments.length) === fn.length) {
return fn.apply(null, nextArgs)
} else {
return partial(nextArgs);
}
}
@carlosrberto
carlosrberto / async-execution-with-generators.js
Created July 11, 2017 14:00
Async code execution with generators
const isPromise = fn => fn && fn.then;
const getUser = () => new Promise((resolve, reject) => {
setTimeout(()=> {
resolve({name: 'John Lavoier'});
}, 2000);
});
const getProfile = () => new Promise((resolve, reject) => {
setTimeout(()=> {