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 <SFML/Graphics.hpp> | |
#include "Box2D/Box2D.h" | |
static const float SCALE = 30.f; | |
void create_balls_and_move_them() | |
{ | |
// define the world; | |
b2Vec2 gravity(b2Vec2(0.f,9.8f)); // check if it dont work | |
b2World world(gravity); |
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 <iostream> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
int find_deviation(vector<int> &, int); | |
int main(int argc, char const *argv[]) | |
{ |
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
function find_deviation(v, d) | |
{ | |
if (v.length <= 0) return 0; | |
start = 0; | |
medians = []; | |
arr_length = v.length; | |
loop_time = arr_length/d; | |
for(var i=0; i< loop_time; i++){ | |
temp_arr = v.slice(start, start+d); | |
find_max = Math.max.apply(null, temp_arr); |
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 <pthread.h> | |
#include <stdio.h> | |
typedef struct student{ | |
char *name; | |
int age; | |
}Student; | |
void *show_student(void *student); |
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
use std::{os}; | |
fn args_avg(vec: &[~str]) -> int { | |
let mut sum = 0; | |
let mut count = 0; | |
for i in vec.iter(){ | |
let x:Option<int> = from_str(*i); | |
if x != None{ | |
sum += x.unwrap(); | |
count += 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
var relationPromise = ArticleRelation.findOne({parentArticleGuid: oldArticle.guid}).exec(); | |
relationPromise | |
.then(function(relation){ | |
if (relation == null){ | |
relation = new ArticleRelation({ | |
parentArticleGuid: oldArticle.guid, | |
organization: task.organization._id | |
}); | |
} |
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
var csv = require('csv'), | |
async = require('async'), | |
fs = require('fs'), | |
path = require('path'), | |
root = __dirname, | |
data = [], | |
maxconcurrency = 5; | |
var mongoose = require('mongoose'); | |
mongoose.set('debug', true); |
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
// node fname.js g model user name | |
var fs =require('fs'); | |
var os = require('os'); | |
var args_list = process.argv; | |
var folder = args_list[3] | |
var model_name = args_list[4] | |
var model_attrs = args_list.slice(5); | |
var eol = os.EOL; | |
// console.log(folder, model_name, model_attrs); |
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
class SimpleOwnerAuthorization(Authorization): | |
''' | |
Does what it says: filters objects by their owner (user). | |
''' | |
def __init__(self, ownerfilter=None, *args, **kwargs): | |
self.ownerfilter = ownerfilter # the user field i.e. 'person__user' | |
def is_authorized(self, request, object=None): | |
return True # for now |
NewerOlder