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 AVFoundation | |
var player: AVAudioPlayer? | |
func playSound(name: String) { | |
// Change extension as needed | |
guard let url = Bundle.main.url(forResource: name, withExtension: "mp3") else { return } | |
do { | |
try AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback) |
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
from matplotlib import pyplot as plt | |
def function(x): | |
# Enter any function (example given by default) | |
return x**2 + 4 | |
def graph_function(): | |
y_points = [] | |
x_points = [] |
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 javax.swing.JApplet; | |
import java.awt.*; | |
public class Applet extends JApplet { | |
// Einstein portrait | |
public void paint(Graphics page) { | |
page.drawRect(50, 50, 40, 40); // Square | |
page.drawRect(60, 80, 225, 30); // Rectangle | |
page.drawOval(75, 65, 20, 20); // Circle | |
page.drawLine(35, 60, 100, 120); // Line |
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
# Only requires the function for submission | |
def solution(k): | |
r,y = [],[] | |
m = 1 | |
while m <= k: | |
if m % 2 == 0: | |
r.append(m ** 2) | |
else: | |
y.append(m ** 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
// Old view in WL: https://www.youtube.com/playlist?list=WL&disable_polymer=true | |
var timer = window.setInterval(function() { | |
var videoDeleteButton = document.querySelector('.pl-video-edit-remove') | |
if (videoDeleteButton) { | |
videoDeleteButton.click() | |
setTimeout(function() { | |
document.querySelector('.yt-uix-load-more').click() | |
}, 5000) | |
} else { | |
window.clearInterval(timer) |
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
#include <iostream> | |
#include <string> | |
using namespace std; | |
int main() { | |
string twelve_hr_str; | |
string initial_hr; | |
int new_hr; | |
string final_24_str; |
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
sample_string = input() | |
def military_time(twelvehour_str): | |
if "PM" in twelvehour_str: | |
if len(twelvehour_str) == 8: | |
initial_hour = twelvehour_str[:2] | |
new_hour = int(initial_hour) + 12 | |
final24_str = str(new_hour) + twelvehour_str[2:5] | |
else: | |
initial_hour = twelvehour_str[0] |
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
package com.matdevtech.multility; | |
// Imports | |
import android.annotation.SuppressLint; | |
import android.app.Activity; | |
import android.content.Context; | |
import android.content.SharedPreferences; | |
import android.graphics.Typeface; | |
import android.os.Bundle; | |
import android.view.LayoutInflater; |
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
package com.matdevtech.multility; | |
// Imports | |
import android.annotation.SuppressLint; | |
import android.content.ClipData; | |
import android.content.ClipboardManager; | |
import android.content.Context; | |
import android.os.Bundle; | |
import android.view.LayoutInflater; | |
import android.view.View; |
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 is_shifted(a, b): | |
shift_list = [] | |
def shift(n, s): | |
tmp = [char for char in s] | |
shift_str = ''.join(tmp[-n:] + tmp[:-n]) | |
return shift_str | |
for i in range(1, len(a)): | |
shift_list.append(shift(i, a)) |
NewerOlder