We can't make this file beautiful and searchable because it's too large.
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
1 43 | |
2 236 | |
3 75 | |
5 237 | |
7 14 | |
8 162 | |
9 47 | |
10 253 | |
11 38 | |
12 130 |
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
@app.route('/', methods=['POST']) | |
@json | |
@authenticate | |
def foo(): | |
do_stuff() | |
# Decorators | |
def json(f): | |
@functools.wraps(f) |
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
def foo(input, filters = {}) | |
return Array(input) if filters.empty? | |
output = [] | |
Array(input).find_all do |e| | |
temp = false | |
t1 = true | |
t2 = true | |
filters.each do |k,v| | |
values = {} | |
if v.is_a?(String) && v.include?('|') |
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
def filter(input, filters = {}) | |
Array(input).find_all do |e| | |
filters.all? do |k, v| | |
filter_vals = v.to_s.split("|").map(&:strip) | |
if e.respond_to?('[]') && !e[k].nil? | |
filter_vals.include?(e[k].to_s) | |
elsif e.respond_to?(k) | |
filter_vals.include?(e.send(k.to_sym)) | |
else | |
false |
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
pthread_mutex_t buffer_mutex = PTHREAD_MUTEX_INITIALIZER; | |
pthread_cond_t buffer_full = PTHREAD_COND_INITIALIZER; | |
pthread_cond_t buffer_empty = PTHREAD_COND_INITIALIZER; | |
int buffer[10]; | |
void buffer_init(void) | |
{ | |
/* printf("buffer_init called: buffer initialized with ten 0s\n"); */ | |
int i = 0; | |
for(i=0; i<10; i++) buffer[i] = 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
package DynamicProgramming; | |
import java.io.*; | |
import java.util.*; | |
public class Joseph { | |
static boolean solve(int N, int M) { | |
int K = N / 2; | |
int p = -1; |
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
//package DynamicProgramming; | |
import java.io.IOException; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) throws IOException { | |
Scanner s = new Scanner(System.in); | |
String m = ""; |
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
package DynamicProgramming; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.Scanner; | |
public class ThreeNPlusOne { |
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
private void generateSpendingReport() throws ParseException{ | |
String from = ""; | |
String to = ""; | |
ParseQuery<ParseObject> query = ParseQuery.getQuery("Transaction"); | |
query.whereEqualTo("owner", ParseUser.getCurrentUser().getEmail()); | |
// query.whereLessThanOrEqualTo("createdAt", to); | |
// query.whereGreaterThanOrEqualTo("createdAt", from); | |
List<ParseObject> results = query.find(); | |
System.out.println("date format: " + results.get(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
__author__ = 'Giorgi Tkeshelashvili' | |
from pprint import pprint | |
def mult_matrix(A, B): | |
""" Multiply square matrices A and B of the same dimension (nxn)""" | |
# Converts N into a list of tuples of columns | |
col_tuples = zip(*B) | |
# Multiply A and B | |
return [[sum(ea*eb for ea,eb in zip(a,b)) for b in col_tuples] for a in A] |
NewerOlder