Skip to content

Instantly share code, notes, and snippets.

@Uphorium
Uphorium / RadioRecord parser.php
Created Nov 13, 2019 — forked from vectorserver/RadioRecord parser.php
Парсер истории треков с Радио Рекорд
View RadioRecord parser.php
<?php
/**
* Created by PhpStorm.
* User: endi
* Date: 25.08.2016
* Time: 23:18
* Скрипт для закачки музыки с http://history.radiorecord.ru
* Запускать строго в консольном режиме иначе пизда серваку
*/
$chanel = "brks"; /*Имя канала*/
View openpanzer-save.json
{"scenario":{"name":"Madrid Offensive","maxTurns":24,"date":"1938-12-24T00:00:00.000Z","atmosferic":0,"latitude":1,"ground":0,"turnsPerDay":4,"dayTurn":2,"reinforcements":{"3":[],"5":[{"row":17,"col":4,"unit":{"eqid":290,"id":-1,"owner":1,"hasMoved":false,"hasFired":false,"hasResupplied":false,"hasOverstrength":false,"isMounted":false,"isSurprised":false,"isDeployed":false,"isCore":false,"tempSpotted":false,"strength":10,"facing":0,"flag":26,"destroyed":false,"player":null,"transport":null,"carrier":0,"moveLeft":3,"ammo":5,"fuel":0,"hasAnimation":false,"hits":0,"experience":0,"entrenchment":0,"entrenchTicks":0,"leader":-1},"turn":"5","id":1},{"row":17,"col":4,"unit":{"eqid":290,"id":-1,"owner":1,"hasMoved":false,"hasFired":false,"hasResupplied":false,"hasOverstrength":false,"isMounted":false,"isSurprised":false,"isDeployed":false,"isCore":false,"tempSpotted":false,"strength":10,"facing":0,"flag":26,"destroyed":false,"player":null,"transport":null,"carrier":0,"moveLeft":3,"ammo":5,"fuel":0,"hasAnimation":false
@davidaarmstrong
davidaarmstrong / can_census_fed.r
Created Nov 13, 2019
This code maps Canada Census Subdivisions from the 2016 Census onto Federal Electoral Districts from the 2013 representation order.
View can_census_fed.r
library(dplyr)
library(sf)
library(rgeos)
library(rgdal)
## Download: https://www12.statcan.gc.ca/census-recensement/2011/geo/bound-limit/bound-limit-2016-eng.cfm
## choose ArcGIS (.shp) and Federal Electoral Districts (2013 Representation Order)
## read in electoral district boundaries.
eb <- read_sf("FED_CA_2_2_ENG.shp")
View controller-test.js
// file: controller.spec.js
const proxyquire = require('proxyquire');
const sinon = require('sinon');
const chai = require('chai');
const { expect } = chai;
describe('calculateTotal', function(done) {
it('calculates the total and updates the database', function() {
@qi-qi
qi-qi / kinesis-firehose-sample.py
Last active Nov 13, 2019
sample code to put record to kinesis firehose
View kinesis-firehose-sample.py
import boto3
import json
client = boto3.client('firehose', aws_access_key_id='aaa', aws_secret_access_key='bbb', region_name='eu-west-1')
payload = {
'id': 111,
'name': 'QiQi',
'email': 'test@test.com'
}
@rust-play
rust-play / playground.rs
Created Nov 13, 2019
Code shared from the Rust Playground
View playground.rs
// 1. Run as-is.
// 2. Comment in the section marked (2). Read the compiler error.
// 3. Comment in the section marked (3). Look how output differs from (1).
use std::mem;
fn print_size_of<T>(_t: &T) {
println!("size: {}", mem::size_of::<T>());
}
@shawty
shawty / GridEditor.razor
Last active Nov 13, 2019
Blazor component to allow editing of a data table using a simple grid and drop down
View GridEditor.razor
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using MyProject.DataModels
@inject MyProject.Services.ClientGridData _gridDataService
@inject MyProject.Services.Clients _dropDownDataService
<div class="row d-flex align-items-center">
<div class="col">
View Coordinate task
from dataclasses import dataclass
@dataclass
class Coordinates:
x: int
y: int
def __str__(self):
return f"({self.x},{self.y})"
View Homework_6-1.py
class BasketballPlayer:
def __init__(self, first_name, last_name, height_cm, weight_kg):
self.first_name = first_name
self.last_name = last_name
self.height_cm = height_cm
self.weight_kg = weight_kg
with open("player_database.txt", "w") as database:
database.write(str(self.__dict__))
You can’t perform that action at this time.