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 <bits/stdc++.h> | |
typedef long long ll; | |
typedef std::tuple<ll, ll, ll> hash_t; | |
using namespace std; | |
class RollingHash { | |
public: | |
hash_t p = {13, 31, 19}; | |
hash_t hashes = {0, 0, 0}; | |
hash_t pows = {1, 1, 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
/* | |
* Source: http://www.zedwood.com/article/cpp-sha256-function/ | |
*/ | |
#include <string> | |
#include <cstring> | |
#include <fstream> | |
#include <iostream> | |
#define SHA2_SHFR(x, n) (x >> n) |
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
http://www.spoj.com/problems/AHOCUR | |
http://www.spoj.com/problems/FINDSR/ | |
http://www.spoj.com/problems/FILRTEST/ | |
http://www.spoj.com/problems/EPALIN/ | |
http://www.spoj.com/problems/PUCMM223 | |
http://www.spoj.com/problems/SPIRALGR/ | |
http://www.spoj.com/problems/DCEPC706/ | |
http://www.spoj.com/problems/MINNUM | |
http://www.spoj.com/problems/NITT2 |
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
const waitFor = (ms) => new Promise(r => setTimeout(r, ms)) | |
const asyncForEach = (array, callback) => { | |
for (let index = 0; index < array.length; index++) { | |
await callback(array[index], index, array) | |
} | |
} | |
const start = async () => { | |
await asyncForEach([1, 2, 3], async (num) => { | |
await waitFor(50) |
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
set nocompatible | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
Plugin 'VundleVim/Vundle.vim' | |
Plugin 'dracula/vim' | |
Plugin 'Valloric/YouCompleteMe' | |
call vundle#end() " required |
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
{ | |
"name": "project", | |
"version": "1.0.0", | |
"description": "A Vue.js project", | |
"author": "Kapil <[email protected]>", | |
"private": true, | |
"scripts": { | |
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", | |
"start": "npm run dev", | |
"lint": "eslint --ext .js,.vue src", |
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
#!/bin/bash | |
# Sometimes you need to move your existing git repository | |
# to a new remote repository (/new remote origin). | |
# Here are a simple and quick steps that does exactly this. | |
# | |
# Let's assume we call "old repo" the repository you wish | |
# to move, and "new repo" the one you wish to move to. | |
# | |
### Step 1. Make sure you have a local copy of all "old repo" | |
### branches and tags. |
All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.
elem.offsetLeft
,elem.offsetTop
,elem.offsetWidth
,elem.offsetHeight
,elem.offsetParent
elem.clientLeft
,elem.clientTop
,elem.clientWidth
,elem.clientHeight
elem.getClientRects()
,elem.getBoundingClientRect()