Skip to content

Instantly share code, notes, and snippets.

View tjdevries's full-sized avatar
🏠
Open Open Source: https://www.twitch.tv/teej_dv

TJ DeVries tjdevries

🏠
Open Open Source: https://www.twitch.tv/teej_dv
View GitHub Profile
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())
}
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
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
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)
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)
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
@tjdevries
tjdevries / this_is_for_prime.lua
Last active September 25, 2021 18:22
<30 minutes PogChamp
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)
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))
@tjdevries
tjdevries / lua_thing.rs
Created June 15, 2021 14:40
I DON'T KNOW ANYTHING ABOUT RUST
use mlua::Lua;
use mlua::Result;
fn main() -> Result<()> {
println!("Hello, world!");
let lua = Lua::new();
{
let mut rust_val = Vec::<i32>::new();
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