Skip to content

Instantly share code, notes, and snippets.

View LandonSchropp's full-sized avatar

Landon Schropp LandonSchropp

View GitHub Profile
@hashrock
hashrock / svg-drag.js
Last active January 31, 2024 13:22
SVG Drag and Drop with React Hooks
import React from "react";
import ReactDOM from "react-dom";
const Circle = () => {
const [position, setPosition] = React.useState({
x: 100,
y: 100,
active: false,
offset: { }
});
@manasthakur
manasthakur / grepping.md
Last active September 24, 2022 13:30
Vim: Creating your own ack.vim/ag.vim

Creating your own ag.vim

Vim provides built-in mechanisms to search through projects in the form of the grep command. However, on large projects, grep is known to be slow; and hence people have been switching to simpler searchers like ack, and faster, parallel (metal?) searchers like ag and pt. Correspondingly, several plugins have been created that integrate these tools in vim: ack.vim, ag.vim, etc.

However, it's actually very easy to get the functionalities these plugins provide (faster search, results in quickfix-window, jumps, previews, and so on) in vanilla Vim itself; in fact, Vim already populates the grep-search results in a quickfix window. We just need to tell Vim to do the following things (use-case: ag):

  • Use ag as the default grep program
  • Open quickfix window by default
  • Create mappin
#!/usr/bin/env rackup
require 'forward'
run Rack::Forwarder.new('google.com')