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 main | |
import "fmt" | |
func main() { | |
fmt.Println("Part 1:", plzNo()) | |
fmt.Println("Part 2:", plzNo2()) | |
fmt.Println("Part 3:", plzNo3()) | |
fmt.Println("Part 4:", plzNo4()) | |
} |
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
from collections import Counter | |
class Solution: | |
def solve(self, nums): | |
c = Counter(nums) | |
for k, v in c.items(): | |
if k == v: | |
return True | |
return 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
local name = "cmp" | |
local find_module = function(name) | |
local loaders = package.loaders | |
for idx, loader in ipairs(package.loaders) do | |
local l = loader(name) | |
if type(l) == "function" then | |
local info = debug.getinfo(l) | |
print("Source File:", info.source) | |
end |
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
port module Main exposing (..) | |
import Browser | |
import Html exposing (Html, button, div, h1, input, li, text, ul) | |
import Html.Attributes exposing (placeholder, type_, value) | |
import Html.Events exposing (on, onClick, onInput) | |
import Json.Decode as D | |
import Json.Decode exposing (Decoder, field, int, string, andThen, fail, succeed) | |
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
func TestNoProjects(t *testing.T) { | |
db := Setup(t) | |
pr := &GormProjectRepository{DB: db} | |
// Don't add any projects | |
// Test | |
allProjects := GetProjects(pr) | |
if len(allProjects) > 0 { | |
t.Errorf("Shouldn't have any projects, but got: %+v\n", allProjects) |
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
local lua_dirs = vim.fn.glob("./lua/*", 0, 1) | |
for _, dir in ipairs(lua_dirs) do | |
dir = string.gsub(dir, "./lua/", "") | |
require("plenary.reload").reload_module(dir) | |
end |
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
local pickers = require "telescope.pickers" | |
local finders = require "telescope.finders" | |
local previewers = require "telescope.previewers" | |
local actions = require "telescope.actions" | |
local action_state = require "telescope.actions.state" | |
local conf = require("telescope.config").values | |
local primeagen_execute = function(opts) |
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 RenameWithQuickfix() | |
local position_params = vim.lsp.util.make_position_params() | |
local new_name = vim.fn.input "New Name > " | |
position_params.newName = new_name | |
vim.lsp.buf_request(0, "textDocument/rename", position_params, function(err, method, result, ...) | |
-- You can uncomment this to see what the result looks like. | |
if false then | |
print(vim.inspect(result)) |
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
use mlua::Lua; | |
use mlua::Result; | |
fn main() -> Result<()> { | |
println!("Hello, world!"); | |
let lua = Lua::new(); | |
{ | |
let mut rust_val = Vec::<i32>::new(); |
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 s:PerlSubstitute(line1, line2, sstring) | |
let l:lines = getline(a:line1, a:line2) | |
" Perl command with 'utf8' enabled | |
" '#line 1' makes error messages prettier, displayed below: | |
" Substitution replacement not terminated at PerlSubstitute line 1. | |
let l:sysresult = systemlist("perl -e 'use utf8;' -e '#line 1 \"PerlSubstitute\"' -pe ". shellescape("s".escape(a:sstring,"%!").";"), l:lines) | |
if v:shell_error | |
echo l:sysresult | |
return |