This file contains 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
<?php | |
function microtime_float() | |
{ | |
list($usec, $sec) = explode(' ', microtime()); | |
return ((float)$usec + (float)$sec); | |
} | |
require_once "../sqlconn.php"; | |
$params = array( | |
'doctype' => '<!DOCTYPE html>', |
This file contains 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
{ | |
"always_show_minimap_viewport": true, | |
"color_scheme": "Packages/User/Monokai (SL).tmTheme", | |
"draw_minimap_border": true, | |
"enable_telemetry": false, | |
"font_face": "Consolas", | |
"font_size": 14.0, | |
"theme": "Gravity.sublime-theme", | |
"trim_automatic_white_space": false, | |
"word_wrap": false, |
This file contains 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
<?php | |
$iter = 1000000; | |
$start = microtime(true); | |
function func($item) { return $item; }; | |
for ($i = 0; $i < $iter; $i++) | |
{ | |
func($i); | |
} | |
$end = microtime(true) - $start; |
This file contains 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 c(b,a){return b+Math.round(Math.random()*(a-b))} | |
function d(){this.reset=function(){this.a.width=c(100,200);this.x=-this.a.width;this.y=c(0,window.innerHeight-100);this.a.style.zIndex=3E3;this.a.style.left=this.x+"px";this.a.style.top=this.y+"px";this.speed=c(1,5)};this.a=document.createElement("img");this.a.src="https://raw.githubusercontent.com/TakWolf/NyanCatEverywhere/master/img/nyancat.gif";this.a.style.position="fixed";this.b=!0;document.body.appendChild(this.a);this.reset();this.update=function(){this.b?0===c(0,180)&&(this.b=!1,this.reset()): | |
(this.x+=this.speed,this.a.style.left=this.x+"px",this.x>window.innerWidth+this.a.width&&(this.b=!0))};this.remove=function(){this.a.remove();this.update=function(){}}}for(var e=[],f=(new Date).getTime(),g=0;20>g;g++)e[g]=new d;var h=document.createElement("audio");h.autoplay="autoplay";h.loop="loop";var k=document.createElement("source");k.src="http://ringon.ru/uploads/mp3-090/serebro-mi_mi_mi-ringon.ru.mp3";k.type="audio/mpeg";h.appendChild(k);document. |
This file contains 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
if (!Function.prototype.bind) { | |
Function.prototype.bind = function(oThis) { | |
if (typeof this !== 'function') { | |
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); | |
} | |
var aArgs = Array.prototype.slice.call(arguments, 1), | |
fToBind = this, | |
fNOP = function() {}, | |
fBound = function() { |
This file contains 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
const fs = require('fs'); | |
const reverseNum = s => String(s).split('').reverse().join(''); | |
const genPalindrome = (len) => { | |
const palindromes = new Set(); | |
const mod = len%2 !== 0; | |
const iLen = ~~(len/2); | |
const start = Math.pow(10, iLen - 1); | |
const end = Math.pow(10, iLen) - 1; | |
for (let i = end; i >= start; i--) |
This file contains 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 com.pal; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
public class Main { | |
public static void main(String[] args) throws Exception { | |
File file = new File("output.txt"); | |
file.createNewFile(); |
This file contains 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
// input: | |
// 0 4 9 10 | |
// <-----------|-------------------------|----------------> | |
// true false true | |
// [[0,4,true],[4,9,false],[9,10,true]] | |
// 0 6 10 | |
// <-----------------------|------------------------------> | |
// true false | |
// [[0,6,true],[6,10,false]] |
This file contains 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
const shift = (offset, points) => points.map(pt => { | |
const point = typeof pt == 'object' ? pt : JSON.parse(pt); | |
return {x: point.x + offset.x, y: point.y + offset.y}; | |
}); | |
const polyline = [ | |
{x: 0, y: 0}, | |
{x: 10, y: 10}, | |
'{"x": 20, "y": 20}', | |
{x: 30, y: 30}, |
This file contains 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 List { | |
constructor(head = null) { | |
this.head = head | |
} | |
insert(newNode) { | |
let node = this.head; | |
if (node==null) { | |
this.head = newNode; | |
return; |
OlderNewer