https://www.codingame.com/ide/puzzle/someones-acting-sus----
Input
6
ABCDEF
5 3
ABC
local ts_utils = require('nvim-treesitter.ts_utils') | |
local get_master_node = function() | |
local node = ts_utils.get_node_at_cursor() | |
if not node then | |
error('Cannot get node at cursor') | |
end | |
-- When in normal mode, find the smallest node starting at the cursor position | |
local root = ts_utils.get_root_for_node(node) |
class Solution { | |
public int lengthOfLongestSubstringTwoDistinct(String s) { | |
int ans = 0; | |
int left = 0; | |
Map<Character, Integer> freq = new HashMap<>(); | |
for(int right = 0; right < s.length(); right++) { | |
char c = s.charAt(right); | |
freq.put(c, freq.getOrDefault(c, 0) + 1); | |
while(freq.size() > 2) { |
<?php | |
namespace App\Utils; | |
use Illuminate\Database\Eloquent\Relations\Relation; | |
use Illuminate\Support\Str; | |
trait EasyRelations | |
{ | |
protected function getDefinedRelations() |
https://www.codingame.com/ide/puzzle/someones-acting-sus----
Input
6
ABCDEF
5 3
ABC
opendb () { | |
[ ! -f .env ] && { echo "No .env file found."; exit 1; } | |
DB_CONNECTION=$(grep DB_CONNECTION .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_HOST=$(grep DB_HOST .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_PORT=$(grep DB_PORT .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_DATABASE=$(grep DB_DATABASE .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_USERNAME=$(grep DB_USERNAME .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) | |
DB_PASSWORD=$(grep DB_PASSWORD .env | grep -v -e '^\s*#' | cut -d '=' -f 2-) |
<?php | |
$data = file_get_contents('https://codeforces.com/api/problemset.problems?tags=greedy'); | |
$data = json_decode($data, true)['result']['problems']; | |
$out = collect($data) | |
->filter(function($row){ | |
return isset($row['rating']) && $row['rating'] >= 500; | |
}) | |
->sortBy('rating') |
<?php | |
function createImage($content) | |
{ | |
$font1 = 5; | |
$width1 = imagefontwidth($font1) * strlen($content); | |
$img_w = 240; | |
$img_h = 64; | |
$image = imagecreatetruecolor($img_w, $img_h); | |
$white = imagecolorallocate($image, 255, 255, 255); |
module FunctionsHelper | |
def render_code(ruby) | |
CodeRender.new.render(ruby) | |
end | |
class CustomRender < Redcarpet::Render::HTML | |
def codespan(code) | |
CodeRender.new.render(code) | |
end | |
end |
In August 2007 a hacker found a way to expose the PHP source code on facebook.com. He retrieved two files and then emailed them to me, and I wrote about the issue:
http://techcrunch.com/2007/08/11/facebook-source-code-leaked/
It became a big deal:
http://www.techmeme.com/070812/p1#a070812p1
The two files are index.php (the homepage) and search.php (the search page)