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 fetchPlays(startDate, endDate) { | |
var headers = { | |
Authorization: 'Bearer ' + getOAuthService().getAccessToken() | |
} | |
var start = new Date(startDate).getTime(); | |
var end = new Date(endDate).getTime(); | |
var url = 'https://api.spotify.com/v1/me/player/recently-played?before=' + end; | |
var data = []; |
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 oauth = {}; | |
/** @const */ | |
oauth.OAUTH_CLIENT_ID = 'OAUTH_CLIENT_ID'; | |
/** @const */ | |
oauth.OAUTH_CLIENT_SECRET = 'OAUTH_CLIENT_SECRET'; | |
/** | |
* This builds an OAuth2 service for connecting to Spotify |
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 sublime | |
import sys | |
from unittest import TestCase | |
class TestNegateSentence(TestCase): | |
def setUp(self): | |
self.view = sublime.active_window().new_file() | |
# make sure we have a window to work with | |
s = sublime.load_settings("Preferences.sublime-settings") | |
s.set("close_windows_when_empty", False) |
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
class SentenceNegator: | |
IRREGULAR_ES_VERB_ENDINGS = ["ss", "x", "ch", "sh", "o"] | |
CONSONANTS = ['a', 'e', 'i', 'o', 'u', 'y'] | |
def negate(self, sentence): | |
# is | |
if sentence.find("isn't") > -1: | |
return sentence.replace("isn't", "is") | |
if sentence.find("isn\\'t") > -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
def find_quotes(self): | |
quotes_regex = r'(\".*?\"|((?<!\\)\'.*?(?<!\\)\'))' | |
iterator = re.finditer(quotes_regex, self.current_line()) | |
for match in iterator: | |
quote_span = match.span() | |
region = sublime.Region(quote_span[0] + self.current_line_start(), quote_span[1] + self.current_line_start()) | |
if region.contains(self.cursor_position): | |
return (quote_span[0], quote_span[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
function checkMaxPresent() { | |
if (numbers[MAX_NUMBER]) { | |
numbers[MAX_NUMBER].css('background-color', 'red'); | |
stop(); | |
alert('SUCCESS'); | |
return; | |
} | |
$('#numbers').html(''); | |
numbers = {}; // usuwa referencje do niepotrzebnych div-ów |
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 MAX_NUMBER = 10000000; | |
var numbers = {}; | |
var interval = null; | |
function getRandomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} |
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 myFunction() { | |
console.log('my func'); | |
} | |
setInterval(function() { | |
var x = getRandomInt(0, 1); | |
if (x == 0) { | |
myFunction(); | |
} |
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
setInterval(function() { | |
var x = getRandomInt(0, 100); | |
$('#numbers').append(x).append("<br/>"); | |
}, 1000); | |
setInterval(function() { | |
fetch('https://www.random.org/integers/?num=1&min=0&max=100&col=1&base=10&format=plain&rnd=new').then(function(response){ | |
return response.text(); | |
}).then(function(number) { | |
$('#numbers').prepend("<br/>").prepend(number); |
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
setInterval(function() { | |
var x = getRandomInt(0, 100); | |
$('#numbers').append(x).append("<br/>"); | |
}, 1000); | |
setInterval(function() { | |
var x = getRandomInt(101, 200); | |
$('#numbers').prepend("<br/>").prepend(x); | |
}, 2000); |