Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am nishanths on github.
  • I am nishanths (https://keybase.io/nishanths) on keybase.
  • I have a public key whose fingerprint is 73F1 FF0F 0976 4B2C 3CE2 10F7 B81C 887F F8EA EA9B

To claim this, I am signing this object:

Falsy values

  • false
  • null
  • undefined
  • +0, -0, NaN, 0n
  • "" (empty string)
  • document.all in browser environments

Values not on this list are truthy.

@nishanths
nishanths / main.js
Last active August 7, 2019 23:46
Electron tray: Drag and Drop events demo
var app = require('app');
var Menu = require('menu');
var Tray = require('tray');
var appIcon = null;
app.on('ready', function(){
// image is null, so image will not be shown in menu bar
// so click around on the system menu bar to locate the space where the tray icon is
appIcon = new Tray(null);
@nishanths
nishanths / fix-datanode-not-running.sh
Last active March 23, 2016 03:02
Fix DataNode not running
# The MIT License (MIT)
#
# Copyright (c) 2016 Nishanth Shanmugham
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
window.onload = () => {
var iframe = document.querySelector("iframe");
var container = iframe.contentDocument.querySelector(".container");
var d = iframe.contentDocument.querySelector(".d");
var hackForceRecompute = () => {
// Any one of the following is sufficient.
iframe.offsetWidth;
iframe.offsetHeight;
iframe.getBoundingClientRect();
@nishanths
nishanths / minima.xml
Created November 25, 2017 22:13 — forked from jiskandar/minima.xml
this is minima stretch blogger template
<!DOCTYPE html>
<html>
<head>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<title><data:blog.pageTitle/></title>
<b:include data='blog' name='all-head-content'/>
<meta content='your-keyword-here' name='keywords'/>
</b:if>
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<title><data:blog.pageName/> - <data:blog.title/></title>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>table-cell</title>
<style>
ul {
background: red; /* purely for visualizing */
}
#!/usr/bin/env bash
set -e
# Updates the freedns.afraid.org DNS record for a domain, if the domain's
# resolved IP does not match the external IP of the machine running this program.
usage() {
echo "usage: afraiddns.sh <domain>"
exit 1
}
main = do
firstName <- getLine
print firstName
-- Functors apply a function that takes a value and returns a value to a
-- wrapped value.
class Functor c where
fmap :: (a -> b) -> c a -> c b
($) :: c a -> (a -> b) -> c b
trap 'echo hello' INT
read
# Output:
#
# % bash trap_basic
# ^Chello
# ^Chello
# ^Chello
# ^Chello