This file contains hidden or 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
public static T[] RemoveAt<T>(this T[] source, int index) | |
{ | |
T[] dest = new T[source.Length - 1]; | |
if( index > 0 ) | |
Array.Copy(source, 0, dest, 0, index); | |
if( index < source.Length - 1 ) | |
Array.Copy(source, index + 1, dest, index, source.Length - index - 1); | |
return dest; |
This file contains hidden or 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 subprocess | |
import signal | |
import os | |
import sys | |
import time | |
import termios | |
old_settings = termios.tcgetattr(sys.stdin) | |
import readchar |
This file contains hidden or 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
DROP TABLE cars; | |
DROP TABLE people; | |
CREATE TABLE people ( | |
id serial PRIMARY KEY, | |
fname varchar(80), | |
lname varchar(80), | |
address varchar(80), | |
postcode varchar(80), | |
city varchar(80), |
This file contains hidden or 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 pyglet | |
from time import time | |
window = pyglet.window.Window() | |
last_update = time() | |
def update(*args): | |
global last_update | |
print('Update was called every:', time()-last_update,'seconds') | |
last_update = time() |
This file contains hidden or 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 <stdlib.h> | |
int main(int argc, char *argv[]) { | |
fd_set * poller; | |
FD_ZERO(poller); | |
} |
This file contains hidden or 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
<html> | |
<head> | |
<script> | |
for (let i=1; i <= 100; i++) { | |
let map = {3: "Fizz", 5: "Buzz"}; | |
let output = "" | |
for (let key in map) { | |
output += i%key==0 ? map[key] : ""; | |
} |
This file contains hidden or 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 pyglet | |
key = pyglet.window.key | |
class main(pyglet.window.Window): | |
def __init__ (self, width=800, height=600, fps=False, *args, **kwargs): | |
super(main, self).__init__(width, height, *args, **kwargs) | |
self.x, self.y = 0, 0 | |
This file contains hidden or 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 pyglet | |
import random | |
pyglet.resource.path = ["resources"] | |
pyglet.resource.reindex() | |
# sets the resource path | |
class Snake_Window(pyglet.window.Window): |
This file contains hidden or 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 socket import * | |
sockets = {} | |
s = socket() | |
s.bind(('', 1234)) | |
s.listen() | |
ns, na = s.accept() | |
sockets[na] = ns |
This file contains hidden or 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 math | |
import pyglet | |
class Coordinate: | |
x = 0 | |
y = 0 | |
def __repr__(self): | |
return f'Coordinate(x: {self.x}, y: {self.y})' |