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 express = require("express"), | |
url = require('url'); | |
var app = express(); | |
var data = {}; | |
app.get('/set', function(request, response) { | |
var queryData = request.query; | |
for (var i in queryData) { |
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 express = require("express"), | |
fs = require('fs'); | |
//database | |
var file = __dirname + "/public/test.db", | |
exists = fs.existsSync(file), | |
sqlite3 = require("sqlite3").verbose(), | |
db = new sqlite3.Database(file); | |
//create table Data with key and value |
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
tab = [] | |
10.times { tab << rand(36) + 1 } | |
#max | |
max = tab[0] | |
tab.each do |x| | |
max = x if x > max | |
end |
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 bitwise(a, b) | |
array = [] | |
array_trunc = [] | |
for i in a..b do | |
array << i.to_s(2) | |
end | |
array.sort.reverse! | |
len = array[0].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
#piggy - pig latin | |
#piggy("This is a string, yeah?") | |
#"Isthay isay a ingstray, eahyay?" | |
#separate words | |
#check if the first letter is capitalized | |
#regex - find first consonant group - from the start | |
#if there is one - move it to the back | |
#add "ay" | |
#capitalize if it was capitalized |
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
n_guesses = 6 | |
guesses = set() | |
word = "never graduate" | |
game_over = False | |
def print_game_state(): | |
global game_over | |
correct = [c for c in guesses if c in word] | |
incorrect = [c for c in guesses if c not in word] |
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 Html exposing (text) | |
import Set | |
import List | |
main = | |
-- text (toString (List.sum (pairs [1, 5, 3, 4, 2] 2))) | |
text (toString (List.sum (pairs [363374326, 364147530, 61825163, 1073065718, 1281246024, | |
1399469912, 428047635, 491595254, 879792181, 1069262793] | |
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
array = open("integerarray.txt") | |
number_list = array.read() | |
number_list = number_list.strip() | |
number_list = [int(i) for i in number_list.split('\n')] | |
def mergesort(splits, array): | |
array_length = len(array) | |
if array_length > 1: | |
middle = array_length//2 | |
left_side = array[:middle] |
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 summation(n): | |
return ((n**2 + n)/2) + 1 | |
def imvalue(i, j): | |
if ((j + i - 1) % 2 == 0): | |
return summation(j + i - 1) - i | |
else: | |
return summation(j + i - 1) - j | |
#edges that are starts of streams |
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
defmodule BF do | |
def new do | |
%{ | |
tape: %{}, | |
ptr: 0, | |
output: "", | |
stack: [], | |
code: [] | |
} | |
end |
OlderNewer