Skip to content

Instantly share code, notes, and snippets.

View vikdotdev's full-sized avatar
📎

Viktor Habchak vikdotdev

📎
View GitHub Profile
@byelipk
byelipk / download_m3u8.rb
Created May 30, 2017 17:18
A utility written in Ruby to download video from M3U8 files. Requires ffmpeg and the Clipboard gem.
# A utility written in Ruby to download video from M3U8 files.
#
# From Wikipedia:
#
# An M3U file is a plain text file that specifies the locations of one or more
# media files. The file is saved with the "m3u" filename extension if the text
# is encoded in the local system's default non-Unicode encoding (e.g., a
# Windows codepage), or with the "m3u8" extension if the text is UTF-8 encoded.
require 'optparse'
@erikras
erikras / SearchBox.js
Last active September 23, 2020 03:03
A search box that replaces a query parameter in the url
import React, { Component, PropTypes } from 'react'
import { withRouter } from 'react-router'
import queryString from 'query-string'
@withRouter
export default class SearchBox extends Component {
static propTypes = {
router: PropTypes.object.isRequired
}
@localshred
localshred / nice_hash_comparison_test.rb
Last active November 22, 2023 13:27
Minitest assert_equal sucks for comparing output diffs of two hashes. Using HashDiff, awesome_print, and StringIO we can get actual comparable hashes without pulling our hair out.
require "test_helper"
require "awesome_print"
require "hashdiff"
class MyClass
def self.do_stuff
{a:[{y:3}, {x:11, z:33}], b:{y:22}}
end
end
@jeffeb3
jeffeb3 / .Xmodmap
Created January 29, 2016 00:08
Xmodmap for mimicking pok3r keyboard layer.
! Trying to F*** with my keyboard.
!
! The theory is that if I make the caps lock be the "Mode_switch" key,
! then I can change what happens for each key when I press the "Mode_switch" key.
!
! I'm not using the "Mode_switch" key anyway...
!
! This will make the caps lock be the "Mode_switch" key.
clear Lock

This is unmaintained, please visit Ben-PH/spacemacs-cheatsheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
@Bekbolatov
Bekbolatov / tmux.md
Last active August 27, 2025 10:57
Clean tmux cheat-sheet

Clean tmux cheat-sheet

By resources

sessions

list-sessions        ls         -- List sessions managed by server
new-session          new        -- Create a new session
@jwood
jwood / application.html.erb
Last active March 15, 2021 16:03
Disable animations
<!-- app/views/layouts/application.html.erb -->
<!DOCTYPE html>
<html lang="en">
<head>
<!-- ... -->
<% if Rails.application.config.disable_animations %>
<%= stylesheet_link_tag('disable_animations') %>
<!-- Turn off animations in jQuery -->
<script>$.fx.off = true;</script>
@iangreenleaf
iangreenleaf / gist:b206d09c587e8fc6399e
Last active September 5, 2025 19:33
Rails naming conventions

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

@alexhawkins
alexhawkins / HashTable.js
Last active August 7, 2021 23:33
Correct Implementation of a Hash Table in JavaScript
var HashTable = function() {
this._storage = [];
this._count = 0;
this._limit = 8;
}
HashTable.prototype.insert = function(key, value) {
//create an index for our storage location by passing it through our hashing function
var index = this.hashFunc(key, this._limit);
@robinrendle
robinrendle / reset.css
Last active July 24, 2021 01:20
A CSS reset with sane defaults
/*Box sizing (the nuclear option) */
*, *:before, *:after {
-ms-box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing:border-box;
box-sizing: border-box;
}
/* Fix font rendering defaults */
html, button {