Skip to content

Instantly share code, notes, and snippets.

View deepak's full-sized avatar

Deepak Kannan deepak

View GitHub Profile
@deepak
deepak / misc.txt
Last active January 31, 2017 07:24
webpack vs electron-forge
karl.jakober [7:13 AM]
looking for a good alternative to webview.ContentWindow.postMessage for electron, people are saying webview.send is a good alternative, but that requires ipc to be invoked inside the webview itself
@deepak
deepak / README.md
Last active January 19, 2017 13:15
electron-forge does not work on windows

packaging an Electron app on windows, using "Node.js command prompt"

steps to reproduce:

  1. git clone https://github.com/deepak/electron-webview-todo/ && cd
  2. npm install
  3. npm install -g electron-forge
  4. npm run package:win32

packaging works on windows though:

@deepak
deepak / README.md
Last active January 10, 2017 11:07
Using react-router with a file url

open the 'index.html' file in the browser. url will be like "file:///Users/deepak/Code/static/index.html#/"

this is possible because we use hashHistory and not browserHistory

need this in situations where - we use file based urls. we might need/prefer file based urls because:

  1. prototyping
  2. there is no server to serve html files. so no urls. although this is simple
@deepak
deepak / hack.js
Created January 5, 2017 13:36
override content in Electron webview
const { ipcRenderer } = require('electron');
ipcRenderer.on('ping', () => {
console.log(document);
console.log(document.querySelector('input'));
// the document references to the document of the <webview>
document.querySelector('input').addEventListener('change', function(event) {
event.preventDefault();
console.log("====> test");
@deepak
deepak / # node@6 - 2016-12-26_16-24-30.txt
Created December 26, 2016 11:06
node@6 on macOS 10.10.5 - Homebrew build logs
Homebrew build logs for node@6 on macOS 10.10.5
Build date: 2016-12-26 16:24:30
@deepak
deepak / elm-2-functions-diff.elm
Created September 30, 2016 10:25
Elm, what is the difference btw these two functions ?
-- Elm, what is the difference ?
\x y -> (x y) -- <function> : (a -> b) -> a -> b
\x y -> (x, y) -- <function> : a -> b -> ( a, b )
-- trying in elm-repl
import Random
type Msg = Foo Bool
r = (Random.generate Foo Random.bool)
-- { type = "leaf", home = "Random", value = Generate (Generator <function>) }
-- : Platform.Cmd.Cmd Repl.Msg
@deepak
deepak / trying-elm.elm
Last active September 29, 2016 09:56
trying elm
foo = 10
((-) foo 1)
((-) 1 foo)
-- derived type
-- cmd1 : a -> number
cmd1 = \op -> ((-) foo 1)
cmd1 (-1) -- 9
@deepak
deepak / elm-new.sh
Created September 14, 2016 11:25
elm-new.sh
function elm-new() {
mkdir -p $1
cd $1
# from https://github.com/github/gitignore/blob/master/Elm.gitignore
echo "# elm-package generated files
elm-stuff
# elm-repl generated files
repl-temp-*" > .gitignore
@deepak
deepak / validaitions-demo.html
Last active September 14, 2016 06:11
validaitions demo
<!DOCTYPE html>
<html lang="en">
<head>
<!-- These meta tags come first. -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>React Validation Demo</title>