Skip to content

Instantly share code, notes, and snippets.

@kxzk
kxzk / relative_nums.vim
Created September 22, 2017 19:32
relative_nums.vim
set number " show line numbers in vim
set relativenumber " show relative line numbers
@kxzk
kxzk / helloworld.R
Created October 18, 2017 16:51
helloword using Shiny
# contents of app.R
library(shiny)
ui <- fluidPage(
titlePanel('Hello World')
)
# contents of app.R
library(shiny)
ui <- fluidPage(
# our title
titlePanel('Wordcloud Web App'),
# defining the sidebar
server <- function(input, output) {
# defining a reactive function
# reacts to changes in the ngram slider
# by taking it out of the output$wordcloud function
# we have more control over when our dplyr statement
# will get updated
ngrams <- reactive({
# the $<name> is used to reference the name
call pathogen#infect()
filetype plugin indent on
syntax on
runtime macros/matchit.vim
"""""""""""""""""""
" USEFUL DEFAULTS "
"""""""""""""""""""
@kxzk
kxzk / grab_all_links.rs
Created January 5, 2018 05:24
Scrape all links from Hacker News
@kxzk
kxzk / scraper_stories.rs
Last active January 5, 2018 22:24
Grab all headlines from Hacker News into a vector
extern crate reqwest;
extern crate scraper;
// importation syntax
use scraper::{Html, Selector};
fn main() {
hn_headlines("https://news.ycombinator.com");
}
@kxzk
kxzk / rank_story_url.rs
Last active January 5, 2018 23:03
Grabbing the Rank, Headline and URL for Hacker News
extern crate reqwest;
extern crate select;
use select::document::Document;
use select::predicate::{Class, Name, Predicate};
fn main() {
hacker_news("https://news.ycombinator.com");
}
@kxzk
kxzk / hn_cli.rs
Created January 5, 2018 23:16
Hacker News CLI using PrettyTable
// specifying we'll be using a macro from
// the prettytable crate (ex: row!())
#[macro_use]
extern crate prettytable;
extern crate reqwest;
extern crate select;
use select::document::Document;
use select::predicate::{Class, Name, Predicate};
use prettytable::Table;
@kxzk
kxzk / my_line.vim
Created January 8, 2018 04:09
my current statusline
" Function: display errors from Ale in statusline
function! LinterStatus() abort
let l:counts = ale#statusline#Count(bufnr(''))
let l:all_errors = l:counts.error + l:counts.style_error
let l:all_non_errors = l:counts.total - l:all_errors
return l:counts.total == 0 ? '' : printf(
\ 'W:%d E:%d',
\ l:all_non_errors,
\ l:all_errors
\)