language stringclasses 15
values | src_encoding stringclasses 34
values | length_bytes int64 6 7.85M | score float64 1.5 5.69 | int_score int64 2 5 | detected_licenses listlengths 0 160 | license_type stringclasses 2
values | text stringlengths 9 7.85M |
|---|---|---|---|---|---|---|---|
C# | UTF-8 | 2,971 | 3.328125 | 3 | [] | no_license | using System;
namespace PRG2_20192_P1_4_02
{
class Program
{
static void Main(string[] args)
{
float hipotenusa;
Console.WriteLine("MENU SEGITIGA SIKU-SIKU");
Console.WriteLine("1.Hitung Luas");
Console.WriteLine("2.Hitung Hipotenusa... |
PHP | UTF-8 | 1,277 | 2.625 | 3 | [] | no_license | <?php
function conectar_mysql(){
$server='localhost';
$user='root';
$password='';
$db='paises';
$conectar=mysqli_connect($server,$user,$password,$db);
if(!$conectar){
die("Error al conectar con la bd");
}
return $conectar;
}
function get_list(){
$retval='';
$retval='
<table alig... |
TypeScript | UTF-8 | 296 | 2.953125 | 3 | [] | no_license | class Library {
titles!: string[];
address: string = "1 Duck Lane";
isPublic: boolean;
constructor() {
this.isPublic = true;
}
}
const library = new Library();
// sometime later & elsewhere in our codebase..
const shortTitles = library.titles.filter(
book => book.length < 5
); |
Swift | UTF-8 | 3,348 | 2.53125 | 3 | [
"LicenseRef-scancode-warranty-disclaimer"
] | permissive |
// Borrowed from Vapor (Date Middleware)
// https://github.com/vapor/vapor/blob/master/Sources/Vapor/Middleware/DateMiddleware.swift
import Foundation
#if os(Linux)
import Glibc
#else
import Darwin.C
#endif
fileprivate let DAY_NAMES = [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
]
fileprivate let MONTH_NAM... |
Markdown | UTF-8 | 1,256 | 2.53125 | 3 | [] | no_license | # Programming_exercise_problems
[](https://996.icu) :+1:
## 内容包括
1. 平时遇到的算法题
2. [《Data Structure & Algorithm in Python 》](https://book.douban.com/subject/10607365/)一书中的算法
<img src = "https://github.com/shawshanks/Programming_exercise_problems/blob/master/Pic... |
C++ | UTF-8 | 9,210 | 2.671875 | 3 | [
"MIT"
] | permissive | #include "ga_class.hpp"
Ga::Ga(const std::string& s_to_find, size_t s_pop_size,
double s_crossover_rate, double s_mutation_rate,
bool s_use_all_printable_chars)
: __to_find(s_to_find), __pop_size(s_pop_size),
__crossover_rate(s_crossover_rate), __mutation_rate(s_mutation_rate),
__use_all_printable_chars(s_use_a... |
PHP | UTF-8 | 1,049 | 2.765625 | 3 | [] | no_license | <?php
namespace Factory;
/**
* 模型加载器
* 产生一个模型的接口对象
*/
class Service
{
protected $namespace = 'Service';
/**
* 加载service
*/
public function add($name)
{
$class_full_name= BS.$this->namespace.BS.$name;
if(\Loader::importFileByNameSpace($this->namespace,$name)){
$... |
Java | UTF-8 | 287 | 1.5625 | 2 | [] | no_license | package com.buccitunes.dao;
import org.springframework.data.repository.CrudRepository;
import com.buccitunes.model.SongMonthlyStat;
import com.buccitunes.model.SongMonthlyStatId;
public interface SongMonthlyStatRepository extends CrudRepository<SongMonthlyStat, SongMonthlyStatId>{
}
|
Java | UTF-8 | 1,324 | 2.4375 | 2 | [] | no_license | package com.epam.tdd;
import com.epam.tdd.domain.Account;
import com.epam.tdd.validator.AccountUserNameValidator;
import com.epam.tdd.validator.FieldValidator;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
... |
Python | UTF-8 | 297 | 3.34375 | 3 | [] | no_license | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
def pro_el_niza(m):
p = 1
i = 0
while i < len(m):
p *= float(m[i])
i+=1
return p
if __name__ == "__main__":
u = raw_input("Elementi niza razdvojeni zarezima ")
niz = u.split(",")
print (pro_el_niza(niz)) |
Markdown | UTF-8 | 2,950 | 3.515625 | 4 | [] | no_license | # Team Hidetada
##### Hasif Ahmed, Kerwin Chen, Wenting Li
Attack of the Vegetables
**Description**
Our final project is to use processing to create the game Bomb-It, but instead of bombs we use vegetables! The goal of the game is ... |
Ruby | UTF-8 | 1,102 | 2.53125 | 3 | [] | no_license | require_relative '../spec/spec_helper'
require_relative '../module/incravinable'
class SalesEngine
include Incravinable
attr_reader :items,
:merchants,
:invoices,
:invoice_items,
:transactions,
:customers,
:analyst
def initiali... |
Java | UTF-8 | 10,923 | 1.609375 | 2 | [] | no_license | package com.tls.liferaylms.report;
import com.tls.liferaylms.test.util.TestProperties;
public class BeanReportContext {
//LoginTest
private static boolean hasLogin = false;
//CreateUsers
private static boolean createStudent = false;
private static boolean createStudent2 = false;
private static boolean crea... |
JavaScript | UTF-8 | 582 | 3.234375 | 3 | [] | no_license | var myState = 0 ;
function setup() {
// put setup code here
createCanvas(800, 800) ;
}
function draw() {
// put drawing code here
switch(myState) {
case 0:
background (255, 0, 0);
break ;
case 1:
background (0, 255, 0);
text("first",100, 100);
rect(10, 10, 50, 50);
... |
Java | UTF-8 | 2,542 | 4.4375 | 4 | [] | no_license | package days10;
// 리턴 값이 존재하는 메소드의 선언
// 메서드 호출 후 메서드에서 계산되어 진 결과를 호출한 지점에서 사용하고자 할 때
// return 명령으로 호출된 지점으로 전달할 수 있습니다.
public class Method06
{
public static void main(String[] args)
{
int num = 77;
int k = squar(5);
System.out.printf("%d의 제곱은 %d입니다.\n", num, k);
int max_result = max(10, 5, 17);
// 리... |
Markdown | UTF-8 | 2,772 | 2.921875 | 3 | [
"MIT"
] | permissive | # Cpp Makefile Tutorial
## GCC/Clang Compiler Steps
### Compilation Steps
1. Preprocessing
2. Compilation
3. Assembler
4. Linking
#### Preprocessing
- Removes comments from the source code
- Macro expansion
- Expansion of header files
- Command: g++ -E main.cc > main.i
#### Compilation
- Translates the preproces... |
PHP | UTF-8 | 338 | 2.796875 | 3 | [
"MIT"
] | permissive | <?php
namespace Nucleus\Provider;
trait ProviderTrait
{
private $registered = [];
public $dependencies;
public function register()
{
foreach($this->dependencies as $name => $obj)
{
$this->registered[$name] = $obj->register();
}
}
public function getRegistered()
{
return $this->... |
Python | UTF-8 | 208 | 3.921875 | 4 | [] | no_license | msg = raw_input('Do you want a coin? ')
coins = 0
while msg != 'no':
if msg == 'yes':
coins += 1
print 'You have %i coins' % coins
msg = raw_input('Do you want a coin?')
print 'Bye!'
|
Java | UTF-8 | 2,115 | 3.953125 | 4 | [] | no_license | package LeetCode;
/**
443. String Compression
Given an array of characters, compress it in-place.
The length after compression must always be smaller than or equal to the original array.
Every element of the array should be a character (not int) of length 1.
After you are done modifying the input array in-pla... |
Java | UTF-8 | 3,941 | 2.21875 | 2 | [
"LicenseRef-scancode-free-unknown",
"ECL-2.0",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-unknown"
] | permissive | /*
* Licensed to The Apereo Foundation under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
*
* The Apereo Foundation licenses this file to you under the Educational
* Community License, Version 2.0 (the "... |
C# | UTF-8 | 1,903 | 3.0625 | 3 | [] | no_license | using System;
using System.Data;
using System.Data.Entity;
using System.Linq;
namespace eLConsultation.Data
{
public class SettingService: ServiceBase
{
protected StoreContext db;
public SettingService()
{
db = new StoreContext();
}
public SettingService(Sto... |
Markdown | UTF-8 | 1,999 | 3.265625 | 3 | [] | no_license | ## 用户角色列表
这个章节我们来处理用户角色的部分,客户端有可能在某些地方显示用户角色信息,例如某个用户的个人页面里,显示出用户是站长,还是管理员。用户的角色信息没必要再单独请求接口了,我们可以通过 Include 机制实现。
## 1. 增加 Transformer
```
$ touch app/Transformers/RoleTransformer.php
```
_app/Transformers/RoleTransformer.php_
```
<?php
namespace App\Transformers;
use Spatie\Permission\Models\Role;
use League\F... |
TypeScript | UTF-8 | 747 | 2.625 | 3 | [
"MIT"
] | permissive | import { Pipe, PipeTransform } from '@angular/core';
import { MovementType } from '../../data/types/properties';
@Pipe({
name: 'speed'
})
export class SpeedPipe implements PipeTransform {
transform(value: {types: Partial<Record<MovementType, number>>, flyHover?: boolean}): string {
let rv = `${value.t... |
C# | UTF-8 | 21,069 | 2.65625 | 3 | [] | no_license | using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Threading;
using System.Collecti... |
C# | UTF-8 | 1,783 | 3.5 | 4 | [] | no_license | using System;
namespace Updog.Domain {
/// <summary>
/// Interface for domain entities to implement.
/// </summary>
public interface IEntity {
#region Properties
/// <summary>
/// Unique integer id of the entity.
/// </summary>
int Id { get; set; }
#endre... |
TypeScript | UTF-8 | 7,942 | 2.59375 | 3 | [
"Apache-2.0"
] | permissive | import { Algorithm, PubkeyBundle, PubkeyBytes } from "@iov/bcp";
import { fromHex } from "@iov/encoding";
import { isValidAddress, pubkeyToAddress, toChecksummedAddress } from "./address";
describe("address", () => {
describe("isValidAddress", () => {
it("should accept non-checksummed addresses (all lower)", ()... |
Markdown | UTF-8 | 2,900 | 2.71875 | 3 | [] | no_license | ---
layout: default
title: "3620.念念不忘阶级斗争"
weight: 3620
---
《人民日报》评论员1968-3-23
念念不忘阶级斗争
《人民日报》评论员
1968.03.23
革命委员会的成立,是无产阶级革命派向党内一小撮走资派夺权斗争的胜利,是一个阶级推翻一个阶级的大革命的胜利,是毛主席的无产阶级革命路线的胜利。
被推翻了的阶级敌人决不会死心,决不会睡大觉。他们的黑心眼,总是在谋算着翻案,每日每时企图复辟。如果我们只听到欢庆胜利的锣鼓声,看不到这种锣鼓声背后的严酷的阶级斗争的现实,我们就会吃大亏,胜利的果实就有丧失的危险。
毛主席教导我们:“因为胜利,人民感谢我们,资产阶级也... |
C | UTF-8 | 11,162 | 2.78125 | 3 | [] | no_license | #ifndef DRYAD_BST2SORTED_ITER_DEFS_H
#define DRYAD_BST2SORTED_ITER_DEFS_H
#include <vcc.h>
#include <stdlib.h>
//#include "intbag_defs.h"
//#include "intset_defs.h"
typedef
_(dryad "bst:bst_R:bst_keys:sortl:sortl_R:sortl_keys:stack:stack_R:stack_keys")
struct node
{
struct node * next;
struct node * left;
struct... |
Markdown | UTF-8 | 2,092 | 3.03125 | 3 | [] | no_license | # Project: Communicate Data Findings (Prosper Loan Data)
## by Shivam Chauhan
## Dataset Overview
> The data set contains 113,937 loans with 81 variables on each loan.
### Some important features:
>- LoanStatus : Current status of the loan like chargedoff, completed, defauted etc…
>- EstimatedEffectiveYield : Yield... |
TypeScript | UTF-8 | 5,755 | 3.171875 | 3 | [] | no_license | 'use strict'
import { VALID_ELEMS } from './valid-elems'
import { VALID_ATTRS } from './valid-attrs'
type vDOMType = {
type: string,
children: any[],
props: {
[index: string]: any
}
}
/**
* Append the element if the function receives a container, if not it returns the own element
*
* @param {HTMLEleme... |
Python | UTF-8 | 1,645 | 2.90625 | 3 | [] | no_license | class Scraper(metaclass=abc.ABCMeta):
@abc.abstractmethod
def get_api(self):
pass
@abc.abstractmethod
def get_data(self):
pass
@abc.abstractmethod
def extract_data(self, page_data):
pass
@staticmethod
def _construct_api(**kwargs):
retur... |
C++ | UTF-8 | 1,883 | 2.875 | 3 | [] | no_license | /*
* Résidence Ritournelle, Nantes / Ping, atelier partagé du Breil, 18 juin 2019
* Circuit pour tester l'envoi de commandes midi au prototype de Ritournelle
* Les commandes MIDI sont envoyées directement sans passer par la lib. MIDI
*
* arduino 1.8.5 @ Kirin, debian 9 stretch
* + lib SoftwareSerial 1.0 http://... |
JavaScript | UTF-8 | 6,711 | 2.625 | 3 | [] | no_license |
// require(back.... na ! just kidding !
/**
* Controller class for the HAL I.A, handling it's own view for now.
*
* @type {*}
*/
var Hal = Kitty.Class.extend({
initialize : function(options) {
this.state = options.state;
this.state.on("user:question", this.onUserQuestion, this);
},
o... |
C# | UTF-8 | 1,916 | 2.8125 | 3 | [] | no_license | namespace Tijdsmeting.Migrations
{
using System;
using System.Data.Entity;
using System.Data.Entity.Migrations;
using System.Linq;
using Tijdsmeting.Model;
internal sealed class Configuration : DbMigrationsConfiguration<Tijdsmeting.DAL.ApplicationDbContext>
{
public Configuration()
... |
C# | UTF-8 | 482 | 2.5625 | 3 | [] | no_license | using System;
namespace WebStudio.Classes
{
public class Developer : Employee
{
//TODO: id
public Developer(string name, int hourCost)
{
base.name = name;
base.position = "Developer";
base.hourCost = hourCost;
// base.id
}
... |
Go | UTF-8 | 5,962 | 2.578125 | 3 | [] | no_license | package handle
import (
"fmt"
"github.com/cgao/mv-tweets-data/model"
"strconv"
"strings"
)
func analyze_entities(entities *model.ENTITIES) int64 {
var hashtags_index_slice []string
var hashtags_index string
if &entities.Hashtags != nil {
for i := range entities.Hashtags {
hashtags_index_slice = append(has... |
Python | UTF-8 | 1,862 | 2.984375 | 3 | [
"MIT"
] | permissive | #!usr/bin/env python
#random mask generation with range 0-1
#usage: python generate_windows.py image_size generate_num
import random
import numpy as np
from PIL import Image
import sys
action_list = [[0,1],[0,-1],[1,0],[-1,0]]
def clip(a):
return 0 if a<0 else (255 if a>255 else a)
def array_to_img(im):
#im =... |
Python | UTF-8 | 1,906 | 2.875 | 3 | [] | no_license | #!/usr/bin/env Python
import sys
import ftplib
import datetime
from ftplib import FTP
# Usage:
# sendfile.py "filename" "ftppath" "host" "ip"
def printf(string):
print(datetime.datetime.strftime(datetime.datetime.now(), '%Y-%m-%d %H:%M:%S') + " : " + string);
def checkfolder(ftp):
files = []
try:
... |
C# | UTF-8 | 16,495 | 2.984375 | 3 | [] | no_license | /* Program : NyanWars MOBA V0.0.1
* Author : Travis Crumley, Dane Purkeypile, Ivan Alvarado, Misha Brajnikoff, Luke Travis, Stephen Treat, Alex Ziesmer
* Date : Wednesday, December 17 2014
* Files : GameManager.cs
* Purpose : Controls the start up of the game and instantiates objects for the game.
... |
Java | UTF-8 | 509 | 3.046875 | 3 | [] | no_license | package skrudra.alads;
public class SecondHighest {
public static void main(String[] args) {
// int[] ar = { 2, 3, 6, 6, 5 };
int[] ar = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
int m = ar[0];
int s = ar[1];
if (ar[0] > ar[1]) {
m = ar[0];
s = ar[1];
} else {
m = ar[1];
s = ar[0];
}
int t = Inte... |
Markdown | UTF-8 | 551 | 3.015625 | 3 | [] | no_license | ## Spotify
Consumes the Spotify API and returns a list of related artists.
#### Instructions:
Run `node index.js artist1 artist2`, where artist1 and artist2 are the names of the artists you want to search for related artists between. Searching for 1 artist is currently not supported, and will return an empty array. A... |
Java | UTF-8 | 2,357 | 2.671875 | 3 | [] | no_license | package com.med.library;
import com.med.library.service.AuthorService;
import com.med.library.service.BookService;
import com.med.library.service.PublisherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApp... |
PHP | UTF-8 | 2,065 | 2.53125 | 3 | [] | no_license |
<?php if(isset($_SESSION['usuario']) && $_SESSION['usuario'] == 'complete'): ?>
<strong class="alert_green">El Usuario se ha creado correctamente</strong>
<?php elseif(isset($_SESSION['usuario']) && $_SESSION['usuario'] != 'complete'): ?>
<strong class="alert_red">El Usuario NO se ha creado correctamente</stro... |
Python | UTF-8 | 10,428 | 2.65625 | 3 | [] | no_license | #!/usr/local/bin/python2.7
### read in the center of mass positions
### compute the center of mass velocity (by direction and absolute quantities)
import numpy as np
import sys, os, math
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import matplotlib.cm as cmx
import random
try:
fname = sys.... |
Python | UTF-8 | 3,104 | 2.546875 | 3 | [
"MIT"
] | permissive | #SPDX-License-Identifier: MIT
"""
Metrics that provide data about messages (of any form) & their associated activity
"""
import datetime
import sqlalchemy as s
import pandas as pd
from augur.api.util import register_metric
from ..server import engine
@register_metric()
def repo_messages(repo_group_id, repo_id=None,... |
Markdown | UTF-8 | 14,051 | 2.640625 | 3 | [] | no_license | # Scottish Ruby Conference 2012 - Edinburgh, UK
Notes and links to the talks I had the pleasure to hear.
It a rough version by now - links to the ScotRubyConf website, Speakerdeck, Lanyard will follow...
## Day 1
1. [Keynote by Mike Lee][day_1_0]
2. [Power Rake by Jim Weirich][day_1_1]
3. [Decoupling Persistence by ... |
Java | UTF-8 | 1,259 | 3.140625 | 3 | [] | no_license | import edu.princeton.cs.algs4.Queue;
import edu.princeton.cs.algs4.Stack;
public class BreadthFirst
{
node edgeTo[];
boolean marked[];
node source,end;
int n;
int visited;
public BreadthFirst(node source,node end,int n)
{
this.edgeTo=new node[n];
this.marked=new boolean[n];... |
C++ | UTF-8 | 1,216 | 2.953125 | 3 | [] | no_license | // Matthew Howard
//CS 2315
// Lab 06
#include <lab06.h>
IntegerSet IntegerSet::Union(const IntegerSet& otherSet) const
{
IntegerSet u(*this);
for (uint e = 0; e < N; e++)
if (this->isMember(e) || otherSet.isMember(e))
u.insertElement(e);
return u;
}
IntegerSet IntegerSet::intersec... |
Ruby | UTF-8 | 50 | 3.0625 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain"
] | permissive | def plus_two(num)
num + 2
end
puts plus_two(3)
|
Java | UTF-8 | 1,510 | 2.5 | 2 | [
"MIT"
] | permissive | package chris.seProxy.util;
import lombok.Getter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* Properties manager
*/
public class PropManager {
private static final String PROP_FILE = "seproxy.prop";
@Getter
private String databaseClass;
@Getter
p... |
C# | UTF-8 | 1,767 | 2.53125 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Med... |
JavaScript | UTF-8 | 14,781 | 2.8125 | 3 | [] | no_license |
let header=document.querySelector('header');
addTagAndAttributes(header, 'div','id','menu-icon','<span class="first"></span><span class="second"></span><span class="third"></span>');
// Скрипт для меню
$("#menu-icon").on("click", function() {
$("nav").slideToggle();
$(this).toggleClass("activ... |
C | UTF-8 | 1,356 | 3.25 | 3 | [] | no_license | /*
* @lc app=leetcode.cn id=860 lang=c
*
* [860] 柠檬水找零
*/
// @lc code=start
bool lemonadeChange(int* bills, int billsSize){
if(billsSize == 0)
return true;
int count_five = 0;
int count_ten = 0;
//第一笔一定是5元
if(bills[0] != 5)
return false;
//最... |
Markdown | UTF-8 | 1,837 | 3.0625 | 3 | [] | no_license | ## Reusable Carousel
### Versions
- Node: 6.9.1
- NPM: 3.8.0
- Webpack: 2.2.1
- es2015
### Description
This is a work in progress for a reusable carousel. Built with ES6, the carousel is a basic full width of its container, with a customizable height. Pass it an array of images and it displays a carousel which plays ... |
Java | UTF-8 | 2,072 | 1.625 | 2 | [] | no_license | // Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.aadhk.restpos.c;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.V... |
PHP | UTF-8 | 272 | 2.640625 | 3 | [] | no_license | <?php
namespace App\Handlers;
use Slim\Handlers\ErrorHandler;
class HttpErrorHandler extends ErrorHandler
{
protected function logError(string $error): void
{
if ($this->statusCode === 500) {
$this->logger->error($error);
}
}
}
|
PHP | UTF-8 | 4,772 | 3.296875 | 3 | [] | no_license | <?php
require_once(MODELS . '/entities/employee.php');
class EmployeesModel extends Model
{
public function __construct()
{
//This calls to the constructor of the class Model is extending
parent::__construct();
// echo '<p>Employees model</p>';
}
public function getAll()
... |
Python | UTF-8 | 1,213 | 3.65625 | 4 | [] | no_license | from collections import deque
def play(players, rounds):
board = deque([0])
player = 0
scores = {}
for marble in xrange(1, rounds+1):
player += 1
if player == players+1:
player = 1
if not marble % 23:
board.rotate(7)
score = marble + board... |
Java | UTF-8 | 4,186 | 2.953125 | 3 | [] | no_license | package com.seleniumOO.ui;
import com.seleniumOO.util.SSOElementType;
import org.openqa.selenium.*;
import java.util.ArrayList;
import java.util.List;
/**
* This class represents an UI element of the BROWSER page. A HTML element.
* Manages a WebDriver instance and a WebElement instance.
*
* Created by Daniela Sá... |
Ruby | UTF-8 | 574 | 4.15625 | 4 | [] | no_license | def palindrome?(string)
string == string.reverse
end
p palindrome?('madam') == true
p palindrome?('Madam') == false # (case matters)
p palindrome?("madam i'm adam") == false # (all characters matter)
p palindrome?('356653') == true
def palindrome2?(array)
array == array.reverse
end
p palindrome2?([1, 2,... |
Rust | UTF-8 | 555 | 2.96875 | 3 | [] | no_license | mod node;
use std::option::Option;
use node;
struct MyLinkedList<T> {
head: NodeRef<T>,
tail: NodeRef<T>
}
impl<T> MyLinkedList<T> {
pub fn new() -> MyLinkedList<T> {
MyLinkedList {
head: Option::None,
tail: Option::None
}
}
pub fn push(value: T) {
... |
Markdown | UTF-8 | 2,097 | 3.125 | 3 | [
"MIT"
] | permissive | # yourTube
TV Calendar for Code Fellows 301 Project
## Project Pitch
There are so many TV shows on the air right now, how can one person possibly find what to watch?
Enter YourTube: your very own TV scheduler!
With our product, a user will select parameters that they want in a show and tell us their schedule. Then t... |
C# | UTF-8 | 2,702 | 2.96875 | 3 | [] | no_license | using System;
using System.Collections.Generic;
namespace Ex03.GarageLogic
{
public class GarageVehicleUtils
{
private List<string> m_VehicleDetails = new List<string>();
private List<string> m_UserInputDetails = new List<string>();
private string m_ModelName = string.Empty;
... |
Java | UTF-8 | 2,040 | 2.359375 | 2 | [] | no_license | package com.example.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.Request... |
Java | UTF-8 | 6,853 | 2.078125 | 2 | [] | no_license | package com.stepdefinition;
import java.net.MalformedURLException;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.test.help.AutoTestHelper;
import org.test.pom.adactin.BookHotel;
import org.test.pom.... |
Java | UTF-8 | 1,965 | 2.125 | 2 | [] | no_license | /*
* Decompiled with CFR 0.151.
*/
package com.zhiyun.protocol.message.usb;
import com.zhiyun.protocol.message.usb.DataType$a;
public final class DataType
extends Enum {
public static final /* enum */ DataType COMMAND;
public static final /* enum */ DataType MEDIA;
public static final /* enum */ DataTyp... |
Java | UTF-8 | 2,400 | 3.5 | 4 | [] | no_license | import java.util.*;
import java.io.*;
class pair {
public int x;
public int y;
pair(int x_, int y_) {
x = x_;
y = y_;
}
}
public class Main {
public static final int INF = 987654321;
static void floyd(int[][] board) {
int n = board[0].length;
for (int k = 1; ... |
PHP | UTF-8 | 5,823 | 2.828125 | 3 | [
"MIT"
] | permissive | <?php
use Fabacks\QueryBuilder;
final class QueryBuilderTest extends \PHPUnit\Framework\TestCase {
public function getBuilder(): QueryBuilder {
return new QueryBuilder();
}
public function test_simpleQuery() {
$q = $this->getBuilder()
->from("users", "u")
... |
C | ISO-8859-1 | 697 | 3.53125 | 4 | [] | no_license | #include <stdio.h>
/* vning 11.5, Sida 254 - repetition
Bygg en egen version av strcat (se sida 203)
Tips: Brja med att ta fram en pekare till nolltecknet i slutet p den text du skall kopiera till
Kopiera sedan till detta stlle som strcpy (Sida 254)
strcat lgger en textrad i slutet p en annan, text ska f text+tilla... |
Markdown | UTF-8 | 1,676 | 2.53125 | 3 | [] | no_license | # Table of contents
* [Introduction](README.md)
## Introduction
* [Introduction](introduction/introduction.md)
* [Course Description](introduction/course-description.md)
* [Resources](introduction/resources.md)
## Day 1
* [0 - Environment Setup](day-1/0-environment-setup.md)
* [1a - Brief Introduction To Angular]... |
Python | UTF-8 | 2,941 | 3.359375 | 3 | [] | no_license | import csv
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import scipy.stats as stats
##read the given data sheet in csv and place the columns in separate lists
class Statistic_Analysis:
def __init__(self):
self.x1 = []
self.x2 = []
self.x3 = []
self.x4 = []
self.x5 = []
self.var_y... |
C# | UTF-8 | 10,508 | 2.640625 | 3 | [] | no_license | using System;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using ViewModel;
namespace View
{
public partial class MainWindow : Window
{
private bool _isDrawing;
priva... |
C++ | UTF-8 | 599 | 2.515625 | 3 | [] | no_license | #include <cstdio>
#define LL long long
LL st,el,n,nrz,sc;
LL gauss(LL n) {
return (n*(n+1LL))/2LL;
}
LL sum(LL a, LL b) {
return gauss(b)-gauss(a-1LL);
}
int main()
{
freopen("numere5.in","r",stdin);
freopen("numere5.out","w",stdout);
scanf("%lld",&n);
for(int i=1; i<=n; ++i) for(int j=1; j<... |
Swift | UTF-8 | 2,624 | 2.921875 | 3 | [] | no_license | //
// FeedView.swift
// MySNS
//
// Created by 박연배 on 2021/07/16.
//
import SwiftUI
import PhotosUI
struct FeedView: View {
@State private var addPostButtonClicked = false
@ObservedObject var feedViewModel: FeedViewModel
var body: some View {
ScrollView(.vertical, showsIndicators:... |
Swift | UTF-8 | 3,856 | 2.671875 | 3 | [
"MIT"
] | permissive | //
// ReportComposer.swift
// MileageTracker
//
// Created by Vlad Alexandru on 04/04/2017.
// Copyright © 2017 Vlad Alexandru. All rights reserved.
//
import UIKit
class ReportComposer: NSObject {
let pathToReportHTMLTemplate = Bundle.main.path(forResource: "raport", ofType: "html")
let pathToSingl... |
C++ | UTF-8 | 2,503 | 2.75 | 3 | [] | no_license | #pragma once
#include "WIN_Container.h"
#include "PAINT_ColourDisplay.h"
#include "WIN_Button.h"
#include "WIN_ColourValueTextbox.h"
#include "WIN_ColourSlider.h"
namespace paint
{
class DrawWindow;
class ColourPicker final : public win::Container
{
public:
ColourPicker() = delete;
ColourPicker(gfx::Recta... |
Python | UTF-8 | 799 | 3.8125 | 4 | [] | no_license | #! /usr/bin/python3
# O comando acima trata-se de uma sheebang para a execução do arquivo no linux (necessario permissao de execução do arquivo)
palavras = 'Palavras ao vento, são só palavras'
lista = ['jovem', 'valor', 'aula', 'comida', 'horario']
# Divide de acordo com o argumento passado
palavras.split('p')
# Ret... |
Java | UTF-8 | 1,593 | 4.25 | 4 | [] | no_license | package main.二叉树;
//请实现一个函数,用来判断一颗二叉树是不是对称的。注意,如果一个二叉树同此二叉树的镜像是同样的,定义其为对称的。
//前序遍历: 根左右 根节点肯定是前序遍历的第一个数
//中序遍历: 中序遍历就是先访问树的左子节点,再访问树的根节点,再访问右子节点
//思路 我们遍历二叉树从根向下,所以保持根一致,然后确保左右值一样
//由于前序遍历 为前左右
//我们定义对称前序遍历 为前右左
//如果左右与右左保持一致,则对称
public class Binary5 {
public class TreeNode {
int val = 0;
TreeN... |
Python | UTF-8 | 2,366 | 2.765625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import sys
# Default Values
n = 100
M = 5
nk = 500
u0 = 5
p = 0.25
Msig = 0.2
try:
n = int(sys.argv[1])
M = int(sys.argv[2])
nk = int(sys.argv[3])
u0 = float(sys.argv[4])
p = float(sys.argv[5])
Msig = float(sys.argv[6])
exc... |
C# | UTF-8 | 2,183 | 2.71875 | 3 | [
"MIT"
] | permissive | using MvvmLib.Logger;
using System;
using System.Windows;
using System.Windows.Controls;
namespace MvvmLib.Navigation
{
/// <summary>
/// <see cref="NavigationSource"/> for <see cref="ContentControl"/>.
/// </summary>
public class ContentControlNavigationSource : NavigationSource
{
private... |
Python | UTF-8 | 286 | 2.515625 | 3 | [
"BSD-2-Clause"
] | permissive | from .S2Location import S2Location
from .terms import SBOL2
class S2GenericLocation(S2Location):
def __init__(self, g, uri):
super(S2GenericLocation, self).__init__(g, uri)
@property
def orientation(self):
return self.get_uri_property(SBOL2.orientation)
|
Java | UTF-8 | 129 | 1.984375 | 2 | [] | no_license | package Inherit;
public interface innerface2 {
public void method4();
public void method5();
public void method6();
}
|
PHP | UTF-8 | 8,147 | 2.578125 | 3 | [] | no_license | <?php
#require_once dirname(__FILE__).'/modelResultSet.php';
#require_once dirname(__FILE__).'/modelField.php';
class modelCollection implements ArrayAccess{
private static $_instances = array();
private static $_idInstances = array();
protected $_modelName = null; // helper
//protected $_hel... |
Java | WINDOWS-1250 | 1,888 | 2.984375 | 3 | [] | no_license | package ch.hszt.hs_2011.aud.exercise_05;
import java.util.*;
public final class Task2Samples {
public static void main(String[] args) {
System.out.println("Uebung 3 - Aufgabe 2");
System.out.println("--------------------");
System.out.println();
Task2 task2Book1
=... |
Python | UTF-8 | 6,174 | 2.65625 | 3 | [
"Apache-2.0"
] | permissive | '''helpers for getting/setting/making/locking attributes on maya nodes'''
import maya.cmds as cmds
import maya.mel as mel
def visOveride(obj,value):
'''hides node using vis override, so unhide all won't unhide'''
cmds.setAttr(obj+'.overrideEnabled',1)
cmds.setAttr(obj+'.overrideVisibility',value)
def hide... |
C++ | UTF-8 | 1,190 | 2.984375 | 3 | [] | no_license | // Copyright 2020 Polina Lukicheva
#ifndef INCLUDE_PERSONAL_H_
#define INCLUDE_PERSONAL_H_
#include "Employee.h"
#include "Interfaces.h"
#include "string"
class Personal : public Employee, WorkBaseTime {
public:
explicit Personal(int id, std::string name, std::string position,
int workTime, int payment)
: ... |
C++ | UTF-8 | 926 | 2.96875 | 3 | [] | no_license | #include "stdafx.h"
#include "Light.h"
/* Create a light with a location, color, and intensity values along with default attenuation (none). */
Light::Light(Vertex location, float ambient, float diffuse, float specular, COLORREF color)
: Light(location, ambient, diffuse, specular, color, DEFAULT_CONSTANT_ATTENUATION,... |
C++ | UTF-8 | 2,563 | 3.828125 | 4 | [] | no_license | /*
UCLA ACM ICPC: Interview Track Leetcode Problem Solutions
Disclaimer: This is not the only valid solution and we do not claim our solutions
to be optimal in terms of runtime or memory usage, we are merely giving example
solutions to questions for learning purposes only
Best Time to Buy and Se... |
C# | UTF-8 | 5,050 | 2.640625 | 3 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using MarriageManiac.Core;
using MarriageManiac.Characters;
namespace MarriageManiac.GameObjects
{
class Ufo : DrawableMovableCollidable, IGameContent
{
... |
C# | UTF-8 | 1,857 | 3.140625 | 3 | [] | no_license | using System;
using RAM.Domain.Helpers.Extensions;
using RAM.Domain.Resources;
namespace RAM.Domain.Model
{
public class MenuItem
{
public Guid Id { get; protected set; }
public string Header { get; protected set; }
public bool IsChecked { get; protected set; }
public static MenuItem GetEmptyInstance()
... |
Java | UTF-8 | 485 | 2.921875 | 3 | [] | no_license | import java.util.Scanner;
/**
* Created by Earne on 2015/9/19.
*/
public class Mogujie_C {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
int r = cin.nextInt();
int x = cin.nextInt();
int y = cin.nextInt();
int p = cin.nextInt();
int... |
Java | UTF-8 | 4,729 | 2.078125 | 2 | [] | no_license | /**
*
*/
package com.hp.wpp.avatar.restmodel.errors;
import java.util.ArrayList;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.Jso... |
C | UTF-8 | 9,858 | 2.765625 | 3 | [] | no_license | /******************************************************************************
* ctcp.c
* ------
* Implementation of cTCP done here. This is the only file you need to change.
* Look at the following files for references and useful functions:
* - ctcp.h: Headers for this file.
* - ctcp_iinked_list.h: Linked l... |
C | UTF-8 | 1,355 | 2.828125 | 3 | [
"MIT"
] | permissive | #include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#include "round.h"
#include "sponge.h"
#include "keccak_f.h"
uint8_t *sponge(uint8_t* M,int32_t size){
int32_t r=72;
int32_t w=8;
/*Padding*/
if((size%r)!=0){//r=72 bytes
M=padding(M,&size);
}
uint64_t ... |
SQL | UTF-8 | 657,040 | 2.671875 | 3 | [
"MIT"
] | permissive | set define off verify off feedback off
whenever sqlerror exit sql.sqlcode rollback
--------------------------------------------------------------------------------
--
-- ORACLE Application Express (APEX) export file
--
-- You should run the script connected to SQL*Plus as the Oracle user
-- APEX_050000 or as the owner ... |
Markdown | UTF-8 | 1,094 | 2.671875 | 3 | [] | no_license | ---
layout: post
title: "Django 1.5 configurable User model"
date: 2012-12-06 12:22:05 -0300
categories: python django
category: django
---
Django 1.5 adds a new feature named "configurable User model" and here is one
of the ways you can use it.
{% highlight python linenos %}
class Account(AbstractBaseUser):
em... |
JavaScript | UTF-8 | 3,641 | 3.265625 | 3 | [] | no_license |
environmentVariableMetadata = function(name, type, required, description) {
this.name = name;
switch(type) {
case "int":
case "bool":
case "string": break;
default: throw new Error("Unexpected type.");
}
this.type = type;
if(typeof required !== "boolean")
... |
C# | UTF-8 | 3,493 | 3.25 | 3 | [] | no_license | public sealed class StringBoxer
{
public string GetBoxedString(string s, Size size, Font font)
{
int longestStringLengthInWidth = 0;
var result = string.Empty;
if (size.Height < font.Height)
{
return string.Empty;
}
using (var bmp = new Bitmap(size.Width, size.Hei... |
C++ | UTF-8 | 1,118 | 2.578125 | 3 | [] | no_license | #include "Screen.hpp"
#include "Config.hpp"
#include "Logger.hpp"
#include "Point.hpp"
#ifdef MSVC
#pragma warning(push, 0)
#endif
#include <SDL_video.h>
#ifdef MSVC
#pragma warning(pop)
#endif
Screen::Screen(const unsigned long _width, const unsigned long _height)
{
width = _width;
height = _height;
surface = ... |
Java | UTF-8 | 5,601 | 2.78125 | 3 | [] | no_license | package appfactory.utils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.apache.http.Header;
import org.apache.http.HttpResponse;
im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.