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 |
|---|---|---|---|---|---|---|---|
Markdown | UTF-8 | 3,847 | 3.03125 | 3 | [
"MIT"
] | permissive | # schlox
> "Who gets fish at a chicken place? That's like getting chicken at a fish
> place!"
> - some guy in front of me in line at Harold's Chicken Shack
Schlox (pronounced like schlock) is an implementation of [the Lox programming
language](https://github.com/munificent/craftinginterpreters/) from Bob
Nystrom's b... |
Markdown | UTF-8 | 4,483 | 2.84375 | 3 | [
"MIT",
"Apache-2.0"
] | permissive | ---
layout: post
title: "JS笔记:高性能javascript"
date: 2017-06-09
author: "Jokin"
catalog: true
header-img: "img/post-bg-digital-native.jpg"
tags:
- Javascript
- 笔记
---
> 去年实习就开始看这本《高性能javascript》,薄薄的一小本,却到临近毕业才认真看个大概。
### 加载和执行
- **将`<script>`标签放置于`<body>`底部**:虽然大多数新版浏览器已经允许并行下载脚本,但是页面必须等待脚本下载执行完毕才能继续,这会阻碍其他... |
Java | UTF-8 | 181 | 2.171875 | 2 | [] | no_license | package com.yoursway.utils.bugs;
public class DefaultBugHandler implements BugHandler {
public void bug(Throwable throwable) {
throwable.printStackTrace(System.err);
}
}
|
Java | UTF-8 | 2,743 | 1.8125 | 2 | [
"Apache-2.0",
"EPL-1.0",
"LGPL-2.0-or-later"
] | permissive | /*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2023 DBeaver Corp and others
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICE... |
Java | UTF-8 | 167 | 2.28125 | 2 | [] | no_license | package com.tj.ex05;
public class Thread01 implements Runnable {
@Override
public void run() {
for(int i=0 ; i<300 ; i++) {
System.out.print('-');
}
}
}
|
Python | UTF-8 | 3,387 | 3.609375 | 4 | [] | no_license | # TO-DO: complete the helpe function below to merge 2 sorted arrays
def merge(left, right):
# we start with 0 and 0 on both side, because we want the left index
merged_array = []
left_index = right_index = 0
while left_index < len(left) and right_index < len(right):
if left[left_index] < right[... |
TypeScript | UTF-8 | 1,018 | 3.109375 | 3 | [
"MIT",
"LicenseRef-scancode-generic-cla"
] | permissive | // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import process from 'process';
import { ITerminalChunk, TerminalChunkKind } from './ITerminalChunk';
import { TerminalWritable } from './TerminalWritable';
/**
* A ... |
Java | UTF-8 | 1,219 | 1.960938 | 2 | [] | no_license | package it.tim.pay.util;
import org.jboss.logging.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Span;
import org.springframework.cloud.sleuth.log.SleuthSlf4jProperties;
import org.springframework.cloud.sleuth.log.Slf4jSpanLogger;
import org.springframework.... |
JavaScript | UTF-8 | 866 | 2.75 | 3 | [] | no_license | const testEnv = require('./test-environment')
const todos = require('../todo')
let testDb = null
// Create a separate in-memory database before each test.
beforeEach(() => {
testDb = testEnv.getTestDb()
return testEnv.initialise(testDb)
})
// Destroy the database connection after each test.
afterEach(() => testE... |
PHP | UTF-8 | 2,619 | 2.59375 | 3 | [
"MIT"
] | permissive | <?php
namespace DMS\SystemBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Result
*
* @ORM\Table()
* @ORM\Entity(repositoryClass="DMS\SystemBundle\Entity\ResultRepository")
*/
class Result
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\Generate... |
Java | UTF-8 | 2,059 | 3.1875 | 3 | [] | no_license | package fr.carbonit;
import java.util.Arrays;
import java.util.stream.Collectors;
public class StringCalculator {
private static final String CUSTOM_SEPARATOR_SYMBOL = "//";
private static final int START_CUSTOM_SEPARATOR = 2;
private static final int END_CUSTOM_SEPARATOR = 3;
private static final int NUMBER_LI... |
C++ | UTF-8 | 1,942 | 2.953125 | 3 | [] | no_license | // -*- C++ -*-
/*!
\file amr/FieldDescriptor.h
\brief Describe a data field.
*/
#if !defined(__amr_FieldDescriptor_h__)
#define __amr_FieldDescriptor_h__
#include "defs.h"
#include <string>
// If we are debugging the whole amr package.
#if defined(DEBUG_amr) && !defined(DEBUG_amr_FieldDescriptor)
#define DEBUG... |
Python | UTF-8 | 1,800 | 3.40625 | 3 | [] | no_license | import unittest
from unittest.mock import MagicMock
from poker.card import Card
from poker.hand import Hand
from poker.player import Player
class PlayerTest(unittest.TestCase):
def test_store_name_and_hand(self):
hand = Hand()
player = Player(name="Boris", hand=hand)
self.assertEqual(play... |
Python | UTF-8 | 195 | 3.9375 | 4 | [
"MIT"
] | permissive | #Lowe Case
#The lower() method returns the string in lower case:
a = "Hello, World!"
print(a.lower())
'''
Terminal:
hello, world!
'''
#https://www.w3schools.com/python/python_strings_modify.asp |
C# | UTF-8 | 2,467 | 3.828125 | 4 | [] | no_license | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArraysLists
{
class Program
{
static void Main(string[] args)
{
var numbers = new[] { 20, 8, 30, 15, 7, 3, 40, 100 };
// Length()
C... |
Java | UTF-8 | 1,259 | 2.390625 | 2 | [] | no_license | package com.epam.component.validation.validator;
import com.epam.component.dao.exception.DaoUserException;
import com.epam.component.lang.Lang;
import com.epam.component.service_locator.ServiceLocator;
import com.epam.component.service_locator.ServiceLocatorEnum;
import com.epam.component.service_locator.ServiceLocato... |
Shell | UTF-8 | 375 | 2.765625 | 3 | [] | no_license | #!/bin/zsh
#
FILENAME=$1
POINTS=`wc -l $FILENAME | awk '{print $1}'`
mv inn.eig inn_original.eig
cp ../files/pre_direct/u_matrix* ./
cp ../files/pre_direct/inn.eig ./
echo $POINTS > k_points.dat
cat $FILENAME >> k_points.dat
cp ../direct.in interpolate.in
sed -i -e 's/auger/interpolate/g' interpolate.in
wannier_in... |
Java | UTF-8 | 1,733 | 2.75 | 3 | [] | no_license | package display;
import java.awt.*;
import java.awt.event.KeyEvent;
import main.Program;
import main.Settings;
import display.component.BackButton;
import display.component.Button;
import display.component.Checkbox;
import display.component.Component;
public class SettingsDisplay extends Display {
private Button ba... |
Python | UTF-8 | 245 | 3.71875 | 4 | [] | no_license | """
User to insert their name and then ouput asking how they are
"""
users_name = input("Hello, who are you?: ")
if users_name == input(""):
print("Hello World")
else:
print("Hello,",users_name,". It is good to meet you.")
|
Java | UTF-8 | 533 | 3.1875 | 3 | [] | no_license | package com.yoonsikum.interview.day05;
/**
* Created by yoonsikum on 2018. 5. 22..
*/
public class Solution1 {
public int climbStairs(int n) {
if(n<=2) return n;
int[] dp = new int[n+1];
dp[1] = 1;
dp[2] = 2;
for(int i=3; i<=n; i++){
dp[i] = dp[i-2] + dp[i-... |
Rust | UTF-8 | 5,420 | 2.640625 | 3 | [] | no_license | use gleam::gl;
use webrender::Renderer;
use webrender::api::{
RenderApi, Transaction, FontInstanceKey,
DocumentId, PipelineId, DisplayListBuilder, Epoch,
units::LayoutSize
};
use euclid::Scale;
use crate::{
webrender_surfman::WebrenderSurfman,
window::Window
};
use std::{rc::Rc, path::PathBuf, fs::File... |
Java | UTF-8 | 203 | 1.703125 | 2 | [] | no_license | package com.peregudova.multinote.requests;
public class GetAllNotesCommand extends Command{
public GetAllNotesCommand(String token, String user) {
super("getallnotes", token, user);
}
}
|
PHP | UTF-8 | 2,640 | 2.59375 | 3 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | <?php
class User_Model extends CI_Model{
public function login_user($username, $password){
$this->db->where(['username' => $username]);
$result = $this->db->get('user');
if($result->num_rows() >= 1){
$user = $result->row_array(0);
... |
Java | UTF-8 | 3,147 | 2.71875 | 3 | [] | no_license | package com.al.ecs.common.util;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESedeKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* IOS java互通加密方案
* @author liusd
* @date 2013-06-25
*/
@Supp... |
C++ | UTF-8 | 355 | 3.453125 | 3 | [] | no_license | #include <iostream>
using namespace std;
int main() {
int a, b, temp;
cout<<"Enter the first number:\n ";
cin>>a;
cout<<"Enter the second number:\n ";
cin>>b;
cout<<n1<<" "<<n2<<" "; //printing 0 and 1
for(i=2;i<number;++i) //loop starts from 2 because 0 and 1 are already printed
{
n3=n1+n2;
cout<<n3<<" ";
... |
Java | UTF-8 | 1,058 | 2.265625 | 2 | [] | no_license | package com.shan.fallinlove;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframewor... |
Python | UTF-8 | 906 | 3.296875 | 3 | [] | no_license | """Get the possiblity of snail can reach D meters in N day
:input:
4
5 4
5 3
4 2
3 2
:return:
0.9960937500
0.8437500000
0.5625000000
0.9375000000
ID : SNAIL
url: https://algospot.com/judge/problem/read/SNAIL
"""
def can_climb(d, n):
cache = [[-1 for _ in range(d*2+1)] for _ ... |
JavaScript | UTF-8 | 13,315 | 2.53125 | 3 | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | var React = require('react');
var AddPhone = require('../add_phone.js');
var AddEmail = React.createClass({
getInitialState: function(){
return {email: this.props.email}
},
handleInputChange: function(e) {
var obj = {},
key = e.target.id,
val = e.target.value;
obj[key] = val;
this.setState(obj);
},
h... |
Python | UTF-8 | 434 | 2.875 | 3 | [
"MIT"
] | permissive | import sys
import re
scale = float(sys.argv[1])
def transform(arg):
parts = arg.group().replace(")", "").split()
return "(xy {} {})".format(scale * float(parts[1]), scale * float(parts[2]))
with open(sys.argv[2], 'r') as infile, open(sys.argv[3], 'w') as outfile:
for line in infile:
line = re.sub... |
Java | UTF-8 | 1,134 | 2.09375 | 2 | [] | no_license | package cn.hzxy.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import c... |
Python | UTF-8 | 186 | 2.8125 | 3 | [] | no_license | N = int(input())
a = list(map(int,input().split()))
ans = 0
c = 1
for i in range(N):
if a[i] == c:
c += 1
else:
ans += 1
if ans == N: print(-1)
else: print(ans) |
Java | TIS-620 | 1,028 | 2.3125 | 2 | [] | no_license | /*
* BooleanImageTableCellRenderer.java
*
* Created on 16 Ҥ 2547, 9:12 .
*/
package com.hosv3.gui.component;
import com.hosv3.utility.Constant;
import java.awt.*;
import javax.swing.*;
import javax.swing.table.*;
/**
*
* @author amp
*/
public class CelRendererLabReport implements TableCellRenderer
{
... |
Python | UTF-8 | 1,179 | 2.78125 | 3 | [] | no_license | import re
from functools import reduce
def no_ws_eq(str, comp):
return re.sub(r'\s', '', str) == comp
def compile_glsl_to_python(glsl_code):
lines = re.split('(;(?!.*{)|{)', glsl_code)
lines = reduce(lambda acc, el: acc[:-1] + [acc[-1] + el] if no_ws_eq(el, ';') or no_ws_eq(el, '{') else acc + [el], lin... |
Python | UTF-8 | 432 | 4.0625 | 4 | [] | no_license | # -*- coding:utf-8 -*-
# 问题:利用条件运算符的嵌套来完成此题:
# 学习成绩>=90分的同学用A表示,60-89分之间的用B表示,60分以下的用C表示
while True:
score = input('please input the score:')
if score == 'q':
break
else:
if int(score) >= 90:
print('A')
elif int(score) >= 60:
print('B')
else:
... |
Python | UTF-8 | 2,632 | 3.59375 | 4 | [] | no_license | #!/usr/bin/python
# -*- coding: utf-8 -*-
'''
hmm homework: flip the coins
Viterbi HMM alignment
for each sequence, find the maximum likelihood state path.
print out the maximum likelihood guess for which position was the first flip of the biased coin
format:
input:
HTHHHHTTTH
output:
state_seq trans_position(coun... |
Java | UTF-8 | 339 | 2.71875 | 3 | [] | no_license | package p1.day22.lambda;
import java.util.Date;
public class LambdaDemo1 {
public static void main(String[] args) {
new Thread(new Runnable(){
@Override
public void run() {
System.out.println("time1:" + new Date());
}
}).start();
new Thread(()->{System.out.println("time2:" + new Date());}).... |
Python | UTF-8 | 580 | 2.796875 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
# -*- coding: cp936 -*-
import cv2
filename='facehand.jpg'
def detect (filename):
hand_cascade=cv2.CascadeClassifier('xml.xml')
img=cv2.imread(filename)
gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
hands=hand_cascade.detectMult... |
Swift | UTF-8 | 1,311 | 2.546875 | 3 | [] | no_license | //
// MenuViewControllerTableViewController.swift
// Guess The Bible Book
//
// Created by Abigail Farrand on 01/08/2015.
// Copyright (c) 2015 Far End Designs. All rights reserved.
//
import UIKit
class MenuViewControllerTableViewController: UITableViewController {
override func viewDidLoad() {
supe... |
C# | UTF-8 | 2,699 | 2.625 | 3 | [
"MIT"
] | permissive | using System;
using System.Text;
using BabelFish.AST;
using BabelFish.Compiler;
using Sigil;
using sly.lexer;
namespace enquanto.Model
{
internal class IfStatement : AST, IStatement<EnquantoType>
{
public IfStatement(IExpression<EnquantoType> condition, IStatement<EnquantoType> thenStmt, IStatement<E... |
Python | UTF-8 | 17,797 | 3.34375 | 3 | [
"MIT"
] | permissive | import numpy as np
class DecisionTree:
'''Decision Tree Classifier.
Note that this class only supports binary classification.
'''
def __init__(self,
criterion,
max_depth,
min_samples_leaf,
sample_feature=False,
conti... |
C++ | UTF-8 | 867 | 2.84375 | 3 | [] | no_license | //MessageSystem.cpp -- implementation file for MessageSystem class
//written 2016/05/16
//Good Day Fishing
//a game written by Jean Park
//created April 2016
#include <iostream>
#include <iomanip>
#include "MessageSystem.hpp"
#include "Player.hpp" //only needed for Player Constant
using namespace std;
u... |
C | UTF-8 | 1,758 | 3.859375 | 4 | [] | no_license | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#define length 10
typedef int DataType;
typedef struct Stack
{
DataType* top;
DataType* base; //栈顶指针
int stackSize;
}Stack;
// 栈的实现接口
//初始化栈
void StackInit(Stack* s){
s->base=(DataType *)malloc(length*sizeof(DataType));
if(!s->base)
{
... |
C# | UTF-8 | 2,158 | 3.46875 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections;
using System.Collections.Generic;
namespace RadioStation.ConsoleStation.Utils
{
public class ConcurrentList<T> : IList<T>
{
private readonly List<T> _list;
public ConcurrentList()
{
_list = new List<T>();
}
public Co... |
Python | UTF-8 | 570 | 3.515625 | 4 | [
"MIT"
] | permissive | """
Given a boolean 2D array of n x m dimensions where each row is sorted. Find the 0-based index of the first row that has the maximum number of 1's.
"""
#https://practice.geeksforgeeks.org/problems/row-with-max-1s0023/1#
class Solution:
def rowWithMax1s(self,arr, n, m):
# code here
count=0
max_count=-1
... |
Shell | UTF-8 | 1,212 | 3.078125 | 3 | [] | no_license | #!/usr/bin/env bash
size=20
for ((i=1; i <= size; ++i))
do
(mkdir -p "subdir$i" && cd "subdir$i" && {
for ((j=1; j < size; ++j))
do
cat > "d1x${i}x${j}.h" <<-EOF
#ifndef D1X${i}X${j}_H
#define D1X${i}X${j}_H
#include "d1x${i}x$((j + 1)).h"
typedef t1x${i}x$((j + 1)) t1x${i}x${j};
... |
JavaScript | UTF-8 | 1,795 | 2.734375 | 3 | [] | no_license | import React, { useState } from "react";
import axios from "axios";
import "./Style.css";
import { Link } from "react-router-dom";
export default function DiscoverMoviesPage() {
const [searchText, set_searchText] = useState("");
const [Status, setStatus] = useState({ status: "idle", data: [] });
const search = ... |
Python | UTF-8 | 1,680 | 2.9375 | 3 | [] | no_license | import requests
import numpy as np
import pandas as pd
from pandas import DataFrame, Series
import sqlite3
import pandas.io.sql as sql
print "puissance de Numpy"
print "------------------"
pythonlistdata = [1,2,3,4]
npconvertdata = np.array(pythonlistdata)
npconvertdata
pythonlistdata
print "avantage de numpy = ob... |
Python | UTF-8 | 1,853 | 3.953125 | 4 | [] | no_license | # Question 2(b) and (d)
import numpy as np
def kill_outliers(array1):
'''
--------------------------------------------------------------------
This function deletes all elements of the array that are greater than
three standard deviations above or below the mean of the series, the
mean, and... |
Java | UTF-8 | 40,174 | 2.34375 | 2 | [] | no_license | package com.xxlib.utils;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.media.MediaScannerConnection;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import com.x... |
C++ | UTF-8 | 4,345 | 2.90625 | 3 | [] | no_license | #if !defined(BOARD_H)
#define BOARD_H
#include "consts.h"
enum b_square {empty, xed = 2, oed = 5};
class Board
{
b_square matrix[3][3];
int count;
inline bool IsCorner(void)
{
return(matrix[0][0] + matrix[0][2] + matrix[2][0] + matrix[2][2] == oed);
}
inline bool IsCenter(void)
{
return(matrix[1][1] == ... |
C | UTF-8 | 2,354 | 2.515625 | 3 | [] | no_license | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* move.c :+: :+: :+: ... |
PHP | UTF-8 | 1,084 | 2.859375 | 3 | [] | no_license | <?php
namespace tapeet\web\component;
class Form {
/** @Parameter('_component') */
public $component;
public $id;
public $pageContextEnabled = true;
function getName() {
$name = array();
$component = $this;
while ($component != null) {
if ($component->_parent != null) {
array_unshift($name, $co... |
Markdown | UTF-8 | 1,366 | 2.640625 | 3 | [] | no_license | # Let's Play
Before we try kubernetes we can do installation for kubernetes-ui. it is optional.
To install kubernetes-ui follow this steps :
```kubectl create -f /home/user/kubernetes/cluster/addons/kube-ui/kube-ui-rc.yaml```
```kubectl create -f /home/user/kubernetes/cluster/addons/kube-ui/kube-ui-svc.yaml --val... |
JavaScript | UTF-8 | 1,084 | 4.1875 | 4 | [] | no_license | /*
Async
Adicionado no ES7 , vindo de outras linguagens, açucar sintático para simplificar o uso de promisses promisses.
Lidar de maneira sequencial com código assíncrono.
Async cria promisses e seu return são promisses resolvidas.
Para tornar uma function assíncrona basta colocar a palavra reservada assync funct... |
Java | UTF-8 | 410 | 3 | 3 | [] | no_license |
public class Transformer {
public interface CallBack {
void callBack(float value);
}
public static void transform(float value, CallBack callBack) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
... |
Markdown | UTF-8 | 6,728 | 2.578125 | 3 | [] | no_license | 四一
清晨4点45分的时候,有一位叫艾华兹·琼斯的律师,把下列声明交给新闻界:
本人应今晚不幸酿成灾难的会议主席杰洛米·K.法兰克伯纳和大纽约市所谓“市民行动团队”的中央委员会授权,公开声明:
所有组织立即解散,一切组织性巡逻活动也立即停止。
法兰克伯纳先生及中央委员会代表所有参加本次立意良好但考虑欠周的群众运动市民,时昨晚在大都会会馆发生的事件,表达最诚挚的谦意和深刻的遗憾。
当记者一再要求发表个人声明时,法兰克伯纳摇头说:“我心情已经乱得什么也说不出来了。谁能说什么呢?我们大错特错了,市长说得一点儿也没错。”
天亮的时候,“怪猫暴动”已经平息下来了,这个“四日行动”成了口... |
Java | ISO-8859-1 | 11,682 | 2.296875 | 2 | [] | no_license | package com.inda.drinks.gui;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import j... |
Python | UTF-8 | 1,832 | 2.984375 | 3 | [] | no_license | # def findPath(maze,n,i,j,path):
# if i<0 or j<0 or i>=n or j>=n or maze[i][j]!=1:
# return
# path.append((i,j))
# if i==n-1 and j==n-1:
# p=""
# for x,y in zip(path,path[1:]):
# if y[0]==x[0]+1:
# p += "D"
# elif y[0]==x[0]-1:
# ... |
JavaScript | UTF-8 | 2,871 | 2.53125 | 3 | [] | no_license | export default class ApiBlogService {
baseUrl = 'https://simple-blog-api.crew.red/';
async getResource(url) {
const res = await fetch(`${this.baseUrl}${url}`);
if (!res.ok) {
throw new Error(`Could not fetch ${url}`
+ `, received ${res.status}`);
}
return res.jso... |
Java | UTF-8 | 272 | 2.71875 | 3 | [] | no_license | import javax.swing.*;
import java.awt.*;
public class ClockFrame extends JFrame {
public static final int DEFAULT_WIDTH = 700;
public static final int DEFAULT_HEIGHT = 700;
public ClockFrame() {
setTitle("Clock");
setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
}
}
|
JavaScript | UTF-8 | 5,134 | 2.5625 | 3 | [] | no_license | /* Profile.js
THG App
This file use to present User Profile details .
@Created by Pulkit Arora
*/
import React, { Component } from 'react';
import { View, Image, Text, ScrollView } from 'react-native';
class ProflieSubCard extends Component {
/*
@props: Get the User profile details.
*/
constructor(props)... |
JavaScript | UTF-8 | 185 | 2.59375 | 3 | [] | no_license | export const tryCatch = async (func) => {
try {
const response = await func();
return await response.json();
} catch (e) {
console.error(`error ${func.name}`, e);
}
}
|
Markdown | UTF-8 | 7,780 | 2.625 | 3 | [
"MIT"
] | permissive | ---
layout: page
title: Lean Prover Zulip Chat Archive
permalink: archive/116395maths/42829Defininginstances.html
---
## [maths](index.html)
### [Defining instances](42829Defininginstances.html)
#### [Sebastien Gouezel (Oct 13 2018 at 18:11)](https://leanprover.zulipchat.com/#narrow/stream/116395-maths/topic/Definin... |
C++ | UTF-8 | 379 | 2.671875 | 3 | [] | no_license | #pragma once
#include <cstdint>
#include <array>
#include <string>
#include <functional>
struct Instruction
{
bool decoded;
std::array<uint8_t, 3> bytes;
std::function<int(std::array<uint8_t, 3>)> execute;
std::function<std::string(std::array<uint8_t, 3>)> to_string;
Instruction();
Instructio... |
Java | UTF-8 | 6,057 | 1.9375 | 2 | [
"LicenseRef-scancode-generic-cla",
"ECL-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | /**********************************************************************************
* $URL$
* $Id$
***********************************************************************************
*
* Copyright (c) 2008, 2009, 2010, 2011, 2013, 2014 Etudes, Inc.
*
* Portions completed before September 1, 2008
* Copyright (c... |
PHP | UTF-8 | 8,855 | 2.515625 | 3 | [] | no_license | <?php
Class email_model extends CI_Model
{
public function enviarEmail($dados = array())
{
$this->load->library('phpmailerlib');
$mail = new PHPMailer();
$mail->SetLanguage("br");
$mail->IsSMTP(); // send via SMTP
//$mail->SMTPDebug = 2;
$mail->H... |
Java | UTF-8 | 1,396 | 2.46875 | 2 | [] | no_license | package com.example.exvu.myapplication;
import android.util.Log;
import android.widget.Toast;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
public class GetData {
public static byte[] getImage(String path) throws Exception {
URL url = new URL(path);
HttpURLC... |
Java | UTF-8 | 1,230 | 1.90625 | 2 | [
"MIT"
] | permissive | package com.ruoyi.project.members.domain;
import com.ruoyi.project.party.domain.DjPartyMember;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.framework.aspectj.lang.annotation.Excel;
import com.ruoyi.framework.web.dom... |
Java | UTF-8 | 3,026 | 2.234375 | 2 | [] | no_license | package edu.arizona.biosemantics.etcsite.server.rpc.semanticmarkup;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import edu.arizona.biosemantics.common.log.LogLevel;
import edu.arizona.biosemantics.etcsite.server.Configuration;
import edu.a... |
Java | UTF-8 | 3,434 | 2.3125 | 2 | [] | no_license | package com.byw.stock.house.track.trading.fetch.api.common;
import com.byw.stock.house.track.trading.fetch.api.HttpClientReferent;
import com.byw.stock.house.platform.log.PlatformLogger;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import io.netty.channel.ChannelHandlerContext;
import... |
Python | UTF-8 | 824 | 3.03125 | 3 | [] | no_license | # To run this, you can install BeautifulSoup
# https://pypi.python.org/pypi/beautifulsoup4
# Or download the file
# http://www.py4e.com/code3/bs4.zip
# and unzip it in the same directory as this file
import urllib.request, urllib.parse, urllib.error
from bs4 import BeautifulSoup
import ssl
import re
# Ignore SSL cer... |
C++ | UTF-8 | 448 | 3.046875 | 3 | [] | no_license | #ifndef LIST_H_
#define LIST_H_
typedef double Item;
class List
{
private:
enum{MAX = 10};
Item items[MAX];
int index;
public:
List();
void add(const Item & item);
bool isEmpty(void) const;
bool isFull(void) const;
void visit(void... |
JavaScript | UTF-8 | 1,776 | 3.015625 | 3 | [] | no_license | import React from 'react';
import './App.css';
//Function for the time
const getTimeString = timestamp => {
let date = new Date(timestamp);
let month = date.getMonth() + 1;
let day = date.getDate();
let hour = date.getHours();
let min = date.getMinutes();
let sec = date.getSeconds();
// 0 padding!
mon... |
Python | UTF-8 | 740 | 3.5625 | 4 | [
"Apache-2.0"
] | permissive |
# -*- coding: utf-8 -*-
'''
File name: code\goldbachs_other_conjecture\sol_46.py
Author: Vaidic Joshi
Date created: Oct 20, 2018
Python Version: 3.x
'''
# Solution to Project Euler Problem #46 :: Goldbach's other conjecture
#
# For more information see:
# https://projecteuler.net/problem=46
# Proble... |
Java | UTF-8 | 3,212 | 2.265625 | 2 | [] | no_license | package com.xuecheng.send.seivice;
import com.xuecheng.framework.domain.Constants;
import com.xuecheng.framework.exception.ExceptionCast;
import com.xuecheng.framework.model.response.CommonCode;
import com.xuecheng.framework.model.response.ResponseResult;
import com.xuecheng.framework.utils.CheckUtils;
import org.apac... |
Java | UTF-8 | 594 | 1.539063 | 2 | [] | no_license | package com.sinosure.mall.sys.service.impl;
import com.sinosure.mall.sys.model.SmsFlashPromotion;
import com.sinosure.mall.sys.mapper.SmsFlashPromotionMapper;
import com.sinosure.mall.sys.service.ISmsFlashPromotionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.s... |
Java | UTF-8 | 912 | 1.921875 | 2 | [] | no_license | package pacha.cano.parcial1.negocio;
import java.util.List;
import pacha.cano.parcial1.modelo.Perfil;
import pacha.cano.parcial1.modelo.Publicacion;
import pacha.cano.parcial1.negocio.exceptions.*;
public interface IPublicacionNegocio {
public List<Publicacion> listado () throws NegocioException; //ta
public P... |
PHP | UTF-8 | 2,869 | 2.90625 | 3 | [] | no_license | <?php
declare(strict_types=1);
namespace Petrunko\Image\Resizer;
use Petrunko\Image\Size\Calculator\CalculatorInterface;
use Petrunko\Image\Size\Size;
class Resizer implements ResizerInterface
{
private const JPG = 'image/jpeg';
private const PNG = 'image/png';
private const GIF = 'image/gif';
priv... |
Java | UTF-8 | 29,465 | 2.484375 | 2 | [
"Apache-2.0"
] | permissive | package fi.aalto.ssg.opentee;
import android.content.Context;
import android.os.RemoteException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import fi.aalto.ssg.opentee.exception.BadParametersException;
import fi.aalto.ssg.opentee.exception.GenericErrorException;
import fi.aalto.ssg.ope... |
Markdown | UTF-8 | 57,115 | 3.421875 | 3 | [] | no_license | ---
title: Modern JS - New ES Features
---
<route>
{
meta: {
title: "New ECMAScript Features",
description: "A showcase of new features added to JavaScript since the 6th edition of ECMAScript.",
order: 20,
}
}
</route>
<Title :title="$route.meta.title" :description="$route.meta.description" />
Now that we kn... |
C# | UTF-8 | 581 | 2.921875 | 3 | [
"MIT"
] | permissive | using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShopInventory
{
class Order
{
private Dictionary<int, int> orderedItems;
public Dictionary<int, int> OrderedItems { get { return orderedItems; } }
public Order(... |
C++ | UTF-8 | 429 | 2.53125 | 3 | [] | no_license | #include<bits/stdc++.h>
using namespace std;
#define sz 20
char str[sz];
int main()
{
int i,j,k,l,n;
scanf("%s",str);
l=strlen(str);
bool key=1;
i=0;
j=l-1;
while(i<=j)
{
if(str[i]!=str[j])
{
key=0;
break;
}
i++;
j--;
}
... |
TypeScript | UTF-8 | 2,842 | 3.75 | 4 | [] | no_license | import { Expr } from './internal/types';
import { absurd } from './internal/types';
// Aliases
export type Option<a> = None<a> | Some<a>;
export type Maybe<a> = Option<a>;
// Base class with instance methods
export class OptionBase<A> {
readonly _A: A;
isSome(): this is Some<A> {
return this instanceof Som... |
Python | UTF-8 | 578 | 3.875 | 4 | [] | no_license | #funcion que invierte la lista
def rev(lista):
reversa = []
#el ciclo empieza en el ultimo elemento de la lista, para ir decrementando mientras sea mayor a -1
for i in range(len(lista)-1, -1, -1):
reversa.append(lista[i])
return reversa
lista1=[]
listaR=[]
bandera = 's'
#se empiezan a tomar dat... |
Markdown | UTF-8 | 7,946 | 3.125 | 3 | [] | no_license | ## Artemis Papanikolaou
A Junior Developer and recent Makers Academy graduate. I am passionate about accessibility and love how my code can have a real impact on people’s lives.
Before Makers, I spent 8+ years working in Pricing and Operations roles in various industries, which gave me invaluable experience in commun... |
Shell | UTF-8 | 272 | 3 | 3 | [] | no_license | #!/bin/bash
display_usage() {
echo -e "\nUsage: $0 [miner.log] [output file name]\n"
}
if [ $# -le 1 ]
then
display_usage
exit 1
fi
grep -E \"ts\":\"2021-\(0[5-9]\|11\|12\)-[0-9]+T[0-9:.]*Z\" $1 | grep -E 'mined new block|winAttemptVRF|mineOne|CAUTION' > $2
|
Python | UTF-8 | 159 | 3.5 | 4 | [] | no_license | def myfunction():
print("Bonjour")
def myfunctionwithargs(x):
print("Function avec args", x)
var = "Bonjour"
myfunction()
myfunctionwithargs(var)
|
C++ | UTF-8 | 2,690 | 2.84375 | 3 | [] | no_license |
#ifndef Parser_h_included
#define Parser_h_included
// $insert baseclass
#include "Parserbase.h"
#include "FlexLexer.h"
#include <cstdlib>
#undef Parser
class Parser: public ParserBase
{
public:
typedef std::map<std::string,var_data> sym_table;
Parser(std::istream& in) : lexer(&in, &std:... |
C# | UTF-8 | 1,721 | 2.953125 | 3 | [
"MIT"
] | permissive | using System;
namespace DahuaSharp
{
public class FieldInfo
{
public FieldAttribute Field { get; private set; }
public Object Value { get; private set; }
public System.Reflection.MemberInfo MemberInfo { get; private set; }
private FieldInfo()
{
}
publi... |
SQL | UTF-8 | 423 | 3.6875 | 4 | [] | no_license | USE sql_store;
SELECT * FROM orders JOIN customers USING (customer_id)
JOIN shippers USING (shipper_id);
-- tampilkan semua client yang sudah melakukan pembayaran gunakan USING dalam query
SELECT p.date, c.name, p.amount, pm.name AS payment_method
FROM payments p
JOIN clients c
USING (client_id)
JOIN payment_method... |
C++ | UTF-8 | 8,872 | 2.828125 | 3 | [] | no_license | /** -*- C++ -*-
* @file Matrix.hpp
* @author Charly LERSTEAU
* @date 2011-03-13
*
* Copyright (c) 2011 Charly LERSTEAU
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without res... |
C | UTF-8 | 2,946 | 3.28125 | 3 | [] | no_license |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdint.h>
#include "bits.h"
//print bit
void Bp(unsigned char n)
{
int i;
for (i=7;i>=0;i--)
{
printf("%u",(n>>i)&1);
}
}
int bitscopy(unsigned char* dest,int dbo/*dest bits offset*/,const unsigned char* src,int ... |
Java | UTF-8 | 3,660 | 1.890625 | 2 | [
"Apache-2.0"
] | permissive | package org.gbif.registry.cli.doisynchronizer;
import org.gbif.api.model.common.DOI;
import org.gbif.api.model.common.User;
import org.gbif.api.service.common.UserService;
import org.gbif.common.messaging.guice.PostalServiceModule;
import org.gbif.doi.service.ServiceConfig;
import org.gbif.doi.service.datacite.DataCit... |
PHP | UTF-8 | 434 | 3.3125 | 3 | [
"MIT"
] | permissive | <?php
namespace Ariselseng\NorwegianBanks;
class NorwegianBank
{
public $bankCode;
public $bankName;
public $prefixes;
function __construct(string $bankCode, string $bankName, array $prefixes = [])
{
$this->bankCode = $bankCode;
$this->bankName = $bankName;
$this->prefixe... |
PHP | UTF-8 | 227 | 3.65625 | 4 | [] | no_license | <?php
function somarInteiro(array $vetorInteiros){
$soma = null;
foreach($vetorInteiros as $numero){
$soma +=$numero;
}
return $soma;
}
$inteiros = [5,10,50,15];
echo somarInteiro($inteiros)
?> |
C++ | UTF-8 | 985 | 3.375 | 3 | [] | no_license | // 1.1
// TapeEquilibrium
// Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|.
// Test Score: 100%
#include <algorithm>
#include <climits>
#include <vector>
using namespace std;
int solution(vector<int> &A) {
const size_t N = A.size();
vector<int> sfw(N), sbw(N);
sfw[0] = A[0];
sbw[... |
PHP | UTF-8 | 2,941 | 2.578125 | 3 | [
"MIT"
] | permissive | <?php
// php composer dump-autoload
function stripUnicode($str){
$string = trim($str); if(!$string){return FALSE;}
$unicode = 'ä|à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ|Ä|À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ|';
$strings = 'a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|a|';
$unicode ... |
C++ | UTF-8 | 1,988 | 2.515625 | 3 | [] | no_license | //
// main.cpp
// Constrained Permutations
//
// Created by Siddhant Jain on 2015-10-05.
// Copyright © 2015 Siddhant Jain. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <stdlib.h>
#include <vector>
#include <string>
#include <queue>
#include <math.h>
#include <fstream>
#include <set>
... |
Shell | UTF-8 | 275 | 3.546875 | 4 | [] | no_license | #!/bin/bash
for fg_color in {0..15}; do
set_foreground=$(tput setaf $fg_color)
for bg_color in {0..15}; do
set_background=$(tput setab $bg_color)
echo -n $set_background$set_foreground
printf ' %2u on %u ' $fg_color $bg_color
done
echo $(tput sgr0)
done
|
C# | UTF-8 | 200 | 2.53125 | 3 | [] | no_license | public void GetData(int? id)
{
// Check all preconditions:
Condition.Requires(id)
.IsNotNull()
.IsInRange(1, 999)
.IsNotEqualTo(128);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.