Skip to content

Instantly share code, notes, and snippets.

@himalay
himalay / regexr-sidebar-toggle.js
Last active January 26, 2017 04:54
Userscript: Add sidebar toggle on RegExr.com
// ==UserScript==
// @name RegExr: toggle sidebar
// @namespace http://tampermonkey.net/
// @version 0.2
// @description Allows you to toggle sidebar on RegExr.com
// @author Himalay
// @match http://www.regexr.com/
// @match http://regexr.com/
// @grant none
// ==/UserScript==
@himalay
himalay / color-emoji-on-linux.sh
Created February 26, 2017 06:31
Color emoji on Arch Linux.
# create folders if does not exist
mkdir -p ~/.fonts
mkdir -p ~/.config/fontconfig/
# download noto color emoji font from https://www.google.com/get/noto/#emoji-zsye-color
# extract NotoColorEmoji.ttf file into ~/.fonts/
# create font config file
cat << 'EOF' > ~/.config/fontconfig/fonts.conf
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE fontconfig SYSTEM "fonts.dtd">

Keybase proof

I hereby claim:

  • I am himalay on github.
  • I am himalay (https://keybase.io/himalay) on keybase.
  • I have a public key ASB5CXkKUJnXrqirOEWiYyTMTtYwrdS3sg4EF3ZTwlc1aAo

To claim this, I am signing this object:

@himalay
himalay / fuzzy.js
Created August 3, 2017 13:47
Fuzzy search function
function fuzzysearch (needle, haystack) {
var hlen = haystack.length
var nlen = needle.length
if (nlen > hlen) {
return false
}
if (nlen === hlen) {
# Rename files to lowercase
for i in `ls -1`; do mv $i "${i,,}" ; done
# Image view
for i in *.jpg; do echo "<img src='$i' />" >> images.html; done;
# updae all pip packages
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
# find and replace foo with bar
@himalay
himalay / cookie.js
Created August 3, 2017 14:17
Parse cookies
@himalay
himalay / hashRouting.js
Created August 3, 2017 14:18
Hash routing in js
(function() {
var Router = {
root: '#/',
routes: [],
urls: [],
titles: [],
add: function(thePath, theUrl, theTitle) {
this.routes.push(thePath);
this.urls.push(theUrl);
this.titles.push(theTitle);
@himalay
himalay / table.css
Created August 3, 2017 14:21
css table
{
display: table /* <table> */
display: table-cell /* <td> */
display: table-row /* <tr> */
display: table-column /* <col> */
display: table-column-group /* <colgroup> */
display: table-footer-group /* <tfoot> */
display: table-header-group /* <thead> */
}
@himalay
himalay / order.sql
Created August 3, 2017 14:21
SQL Query order of execution
SELECT -- 5
DISTINCT column, AGG_FUNC(column_or_expression), ... -- 6
FROM mytable -- 1
JOIN another_table -- 1
ON mytable.column = another_table.column
WHERE constraint_expression -- 2
GROUP BY column -- 3
HAVING constraint_expression -- 4
ORDER BY column ASC/DESC -- 7
LIMIT count OFFSET COUNT; -- 8
@himalay
himalay / font.css
Last active August 3, 2017 14:22
Best font-family for the web
body {
color: #212121;
font-family: "Helvetica Neue", "Calibri Light", Roboto, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
letter-spacing: 0.02em;
}