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
[ | |
// Move out of common paired characters () and [] with `Tab` | |
{ | |
"keys": ["tab"], | |
"command": "move", | |
"args": {"by": "characters", "forward": true}, | |
"context": [ | |
{"key": "auto_complete_visible", "operand": false}, | |
// Check if next char matches (followed by anything) | |
{ "key": "following_text", "operator": "regex_match", "operand": "(:?`|\\)|\\]|\\}).*", "match_all": true }, |
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
var utmParser = function() { | |
var query = window.location.search | |
function decode(value) { | |
try { | |
return decodeURIComponent(value); | |
} catch (e) { | |
debug('error `decode(%o)` - %o', value, e) | |
} | |
} |
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
<iframe id="verse-media-destination-frame" src="https://VERSE-MEDIA-PLAYER-IFRAME-URL"></iframe> | |
<script> | |
//Function to read value of a cookie | |
function readCookie(name) { | |
var cookiename = name + "="; | |
var ca = document.cookie.split(';'); | |
for(var i=0;i < ca.length;i++) { | |
var c = ca[i]; | |
while (c.charAt(0)==' ') c = c.substring(1,c.length); |
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
<script> | |
/** | |
* Provides a fake analytics object that sends all calls to the parent window for processing | |
*/ | |
var analytics = (function() { | |
var eventQueue = []; | |
// Send the events to the frame if it's ready. | |
function flush(method, args) { | |
while (eventQueue.length) { |
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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Datanyze Challenge</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.0/react-dom.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.min.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> | |
<style> |
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
$.ajax({ | |
url: 'MASHAPE-URL', // The URL to the API. You can get this by clicking on "Show CURL example" from an API profile | |
type: 'POST', // The HTTP Method | |
data: {}, // Additional parameters here | |
dataType: 'json', | |
success: function(data) { alert(JSON.stringify(data)); }, | |
error: function(err) { alert(err); }, | |
beforeSend: function(xhr) { | |
xhr.setRequestHeader("X-Mashape-Authorization", "YOUR-MASHAPE-KEY"); // Enter here your Mashape key | |
} |
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 chunk(arr, size) { | |
var results = []; | |
while(arr.length){ | |
results.push(arr.splice(0,size)); | |
} | |
return results; | |
} | |
chunk(["a", "b", "c", "d"], 2); |
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 truncate(str, num) { | |
// Clear out that junk in your trunk | |
return num >= str.length? str: str.slice(0, num - (num <= 3 ? 0 : 3)) + '...'; | |
} | |
truncate("A-tisket a-tasket A green and yellow basket", 11); |
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 end(str, target) { | |
return str.substring(str.length - target.length) === target; | |
} | |
end("Bastian", "n"); |
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 findLongestWord(str) { | |
str = str.split(' '); | |
return str.reduce(function(a,b ){ return a.length > b.length ? a : b;}).length | |
} | |
findLongestWord("The quick brown fox jumped over the lazy dog"); |