Skip to content

Instantly share code, notes, and snippets.

@kenglxn
kenglxn / konamicode.js
Last active August 19, 2017 15:31
simple js function to set up konami kode easter egg (up, up, down, down, left, right, left, right, b, a, enter)
(function () {
var buffer,
latchId,
onKonami,
konamiChk,
code = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65];
onKonami = function () {
console.log("konami!!!");
};
@kenglxn
kenglxn / funshuffle.md
Last active August 29, 2015 14:20
funshuffle for nrk.no

create a bookmarklet with the folllowing content and run it on www.nrk.no

javascript: (function () {
  var txtxtxs = $('body').find('.article-content h3 a'), 
      shuf = [], 
      t,
      tl = txtxtxs.length;
  
 while (shuf.length < tl) {

Unfortunately, the Cisco AnyConnect client for Mac conflicts with Pow. And by "conflicts", I mean it causes a grey-screen-of-death kernel panic anytime you connect to the VPN and Pow is installed.

As an alternative, there is OpenConnect, a command-line client for Cisco's AnyConnect SSL VPN.

Here's how to get it set up on Mac OS X:

  1. OpenConnect can be installed via homebrew:

     brew update
    

brew install openconnect

@kenglxn
kenglxn / canvas_overlay.js
Created March 10, 2014 12:16
canvas_overlay bookmarklet.just add a bookmark with the gist content, and click it when you want an overlay on a page.
javascript:(function() {
var canvas = document.createElement('canvas');
canvas.style.position = 'absolute';
canvas.style.top = '0';
canvas.style.left = '0';
canvas.style.zIndex = '99';
document.body.appendChild(canvas);
var ctx = canvas.getContext('2d');
var body = document.querySelector('body');
@kenglxn
kenglxn / gist:9168797
Created February 23, 2014 08:40
grunt test
➜ intent (master) ✗ ∆ grunt test
Running "clean:server" (clean) task
Cleaning .tmp...OK
Running "concurrent:test" (concurrent) task
Running "coffee:dist" (coffee) task
File .tmp/scripts/app.js created.
File .tmp/scripts/app.js.map created.
File .tmp/scripts/controllers/create-intent.js created.
<a href="foo" title="bar>baz</a>
<rio:someTag attr1="foo"
attr2="bar"
attr3="baz"
attr4="you get the idea"/>
#!/usr/bin/env ruby
# borrowed from gitpro book http://git-scm.com/book/en/Customizing-Git-An-Example-Git-Enforced-Policy
message_file = ARGV[0]
message = File.read(message_file)
$regex = /^(?!#)(.*?)([A-Z0-9]+-\d+)/
if !$regex.match(message)
head = File.read("./.git/HEAD")
@kenglxn
kenglxn / fish_prompt.fish
Created September 10, 2013 12:09
~/.config/fish/functions/fish_prompt.fish
function fish_prompt
if not set -q -g __fish_kenglxn_functions_defined
set -g __fish_kenglxn_functions_defined
function _git_branch_name
echo (git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end
function _is_git_dirty
echo (git status -s --ignore-submodules=dirty ^/dev/null)
@kenglxn
kenglxn / omg.java
Last active December 21, 2015 04:19
ArrayList<File> files = new ArrayList<File>();
for (FileSystemResource csv : processCsvFiles) {
files.add(csv.getFile());
}
return files.toArray(new File[files.size()]);
Configuration file: /Users/ken/dev/git/42cents/_config.yml
Source: /Users/ken/dev/git/42cents
Destination: /Users/ken/dev/git/42cents/_site
Generating... Error reading file /Users/ken/dev/git/42cents/_posts/2010-08-19-pomodoro-technique-and-my-idea-for-a-decent-android-app.textile: invalid byte sequence in US-ASCII
Liquid Exception: invalid byte sequence in US-ASCII in 2010-08-19-pomodoro-technique-and-my-idea-for-a-decent-android-app.textile
/Users/ken/.rvm/gems/ruby-2.0.0-p0@42c/gems/liquid-2.5.0/lib/liquid/template.rb:141:in `split'
/Users/ken/.rvm/gems/ruby-2.0.0-p0@42c/gems/liquid-2.5.0/lib/liquid/template.rb:141:in `tokenize'
/Users/ken/.rvm/gems/ruby-2.0.0-p0@42c/gems/liquid-2.5.0/lib/liquid/template.rb:58:in `parse'
/Users/ken/.rvm/gems/ruby-2.0.0-p0@42c/gems/liquid-2.5.0/lib/liquid/template.rb:46:in `parse'
/Users/ken/.rvm/gems/ruby-2.0.0-p0@42c/gems/jekyll-1.0.2/lib/jekyll/convertible.rb:77:in `render_liquid'