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
$.ajax({ | |
url: 'sinuscriptl2ebsiia', | |
data: {'nimi': 'value'}, | |
success: function(response) { | |
/* | |
Response on vastuse body. Kui su cgi annab välja application/json Content-Type siis on ta kohe javascript object | |
by default on ta vist siiski string | |
*/ | |
console.log(response); | |
}, |
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
$.ajax({ | |
url: 'sinuscriptl2ebsiia', | |
data: {'nimi': 'value'}, | |
success: function(response) { | |
console.log('Yay!'); | |
}, | |
error: function() { | |
console.log('Ikaldus!'); | |
} | |
}).done(function() { |
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 <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#define ASCII_ZERO 48 | |
#define STRING_LENGTH 256 | |
#define RND_OPEN 40 | |
#define RND_CLOSE 41 |
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 <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <ctype.h> | |
#include <string.h> | |
#define WORD_LENGTH 40 | |
typedef struct wordEntry { | |
unsigned int count; |
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 <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
int sum(int *arr, size_t sz) { | |
int sum = 0; | |
for(int i=0;i<sz;i++) { | |
sum += arr[i]; | |
} | |
return sum; |
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 networkx as nx | |
import matplotlib.pyplot as plt | |
import unittest | |
import time | |
def timing_f( f, graph, s): | |
""" | |
Time the given function with the input n times | |
Input: | |
f - function to 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
""" | |
Excercise ?? - The Mandlebrot set | |
""" | |
from PIL import Image | |
def draw_file(grid, filename): | |
img = Image.new('RGB', (len(grid[0]),len(grid)), "black") | |
pixels = img.load(); | |
for i in range(img.size[1]): | |
for j in range(img.size[0]): | |
blue = grid[i][j]%255 |
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
""" | |
Excercise 12 - Generating heatmaps of letter pair frequencies with PIL | |
""" | |
from PIL import Image, ImageDraw | |
import random | |
def words(lines): | |
""" | |
Iterate through all the words | |
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
Excercise 01: (0|1)+ | |
Excercise 02: (0|1)*0 | |
Excercise 03: ((0|1){2})+ | |
Excercise 04: .*(0110|1001)+.* | |
Excercise 05: (.*(0110).*(1001).*)|.*(01101001).*|.*(100110).*|.*(011001).*|.*(011001).* | |
Excercise 09: pick(\s|-)?up truck | |
Excercise 10: ^(\w|\d)+\s+(\w|\d)+\s+(\w|\d|\?)+\s*((\w|\d)+$)? | |
Excercise 11: (cat)+\s(\w+\s){0,2}\s*(hat)+ | |
Excercise 12: ([0-9]|1[0-9]|2[0-3]):([0-5][0-9]) |
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
""" | |
Excercise 8 - A basic blackjack dealer with unittesting | |
""" | |
import unittest | |
class Dealer(): | |
tens = ['T','J','Q','K'] | |
symbols = ['S','C','H','D'] | |
def value_of_hand(self,hand): |
NewerOlder