Skip to content

Instantly share code, notes, and snippets.

View joshwnj's full-sized avatar

Josh Johnston joshwnj

View GitHub Profile
/* @flow */
type F<U, V> = (x: U) => V;
module.exports = function ():F<Object, Object> {
return function (venue: Object):Object {
var errors = {};
if (!venue.name) {
errors.name = "Nombre es requerido";
/* @flow */
type F<U, V> = (x: U) => V;
module.exports = function ():F<Object, Object> {
return function (venue: Object):Object {
var errors = {};
if (!venue.name) {
errors.name = "Nombre es requerido";
javascript:(function () { window.__hkmk_id='robot-test.home.480'; _script=document.createElement('script'); _script.type='text/javascript'; _script.src='http://localhost:8400/static/dist/local-dev.js?' + (new Date()).getTime(); document.getElementsByTagName('head')[0].appendChild(_script); })()
@joshwnj
joshwnj / add-jquery.js
Created October 27, 2014 02:46
bookmarklet to add jquery 1.9.0 to a page
javascript:(function () { var js = document.createElement('script'); js.src = "//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"; document.head.appendChild(js); }())
// ----
// 1. natural spacing
var foo = 'foo';
var bar = 'bar';
var superCalaFragilistic = '...';
// ----
// 2. aligning the `=` sign
@joshwnj
joshwnj / .jshintrc
Created May 30, 2014 06:39
Recommended jshint settings, and example of what they look like
{
"bitwise": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
@joshwnj
joshwnj / socks.sh
Last active February 21, 2017 14:34
toggle osx socks proxy
#!/bin/bash
# source: http://richardkmiller.com/925/script-to-enabledisable-socks-proxy-on-mac-os-x
disable_proxy()
{
sudo networksetup -setsocksfirewallproxystate Wi-Fi off
echo "SOCKS proxy disabled."
}
trap disable_proxy INT
sudo networksetup -setsocksfirewallproxy Wi-Fi 127.0.0.1 9999
@joshwnj
joshwnj / .csslintrc
Created May 12, 2014 03:55
Recommended csslint settings
--ignore=adjoining-classes,box-model,box-sizing,bulletproof-font-face,compatible-vendor-prefixes,display-property-grouping,duplicate-background-images,errors,fallback-colors,floats,font-faces,font-sizes,gradients,ids,outline-none,overqualified-elements,qualified-headings,regex-selectors,rules-count,selector-max,selector-max-approaching,shorthand,text-indent,unique-headings,universal-selector,unqualified-attributes,zero-units
--errors=duplicate-properties,empty-rules,import,important,known-properties,star-property-hack,underscore-property-hack,vendor-prefix

Keybase proof

I hereby claim:

  • I am joshwnj on github.
  • I am joshj (https://keybase.io/joshj) on keybase.
  • I have a public key whose fingerprint is 9B58 E0B4 9D81 6527 5C67 7E78 A05D 6744 702F 5DB7

To claim this, I am signing this object:

;; Very quick hack to use `grasp` for searching js tokens in emacs.
;; Uses (compile) so when you get search results you can quickly step through them with (next-error) and (previous-error)
;; to install:
;; $ npm install -g grasp strip-ansi
(defun grasp-current-buffer (arg)
(interactive "MGrasp: ")
(compile (concat "grasp -H '" arg "' " (buffer-file-name) " | strip-ansi")))