Skip to content

Instantly share code, notes, and snippets.

View movii's full-sized avatar

movii movii

  • Shanghai, China
  • 00:55 (UTC +08:00)
View GitHub Profile
@killercup
killercup / Instapaper.coffee
Created December 4, 2012 16:04
Instapaper xAuth API for client side JS
# # Instapaper API Class
#
# Instapaper xAuth API for client side JS. Depends on cross-domain requests.
#
# Reference: <http://www.instapaper.com/api/full>
#
# xAuth documentation from Twitter: <https://dev.twitter.com/docs/oauth/xauth>
#
# With help from <https://gist.github.com/447636>
#
@boushley
boushley / gist:5471599
Last active May 17, 2019 09:11
A JavaScript UTF-8 decoding function for ArrayBuffers. Credit for most of the heavy lifting goes to "bob" http://ciaranj.blogspot.com/2007/11/utf8-characters-encoding-in-javascript.html
function decodeUtf8(arrayBuffer) {
var result = "";
var i = 0;
var c = 0;
var c1 = 0;
var c2 = 0;
var data = new Uint8Array(arrayBuffer);
// If we have a BOM skip it
@zamozniewicz
zamozniewicz / front-end-blogs.md
Last active July 30, 2019 03:36
Front-end blogs worth reading

##Front-end blogs worth reading##

Even though for the last few years blogs have been losing popularity to Twitter, Facebook and Google Plus and so on, they're still not dead and have not been replaced with other media.

###Articles, showcases, resources###

  • A List Apart - articles design, development, and web standards
  • DailyJS - news, tips, examples and reviews of a variety of JavaScript frameworks and modules.
  • Mozilla Hacks - one of key resources for people developing for the Open Web
@crittermike
crittermike / new_gist_file
Last active March 30, 2020 14:39
Search all git commit diffs for a specific string - both regex and non-regex versions
git rev-list --all | xargs git grep '<YOUR REGEX>' # regex
git rev-list --all | xargs git grep -F '<YOUR STRING>' # non-regex

Unit Tests in Vue.js

Tooling

{
  "karma-mocha": "^0.2.1",
  "karma-chai": "^0.1.0",
  "karma-chai-as-promised": "^0.1.2",
  "karma-sinon": "^1.0.4",
@dominikwilkowski
dominikwilkowski / README.md
Last active October 19, 2020 03:52
Ubuntu setup with NGINX http/2 and letsencrypt

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

The issue:

..mobile browsers will wait approximately 300ms from the time that you tap the button to fire the click event. The reason for this is that the browser is waiting to see if you are actually performing a double tap.

(from a new defunct https://developers.google.com/mobile/articles/fast_buttons article)

touch-action CSS property can be used to disable this behaviour.

touch-action: manipulation The user agent may consider touches that begin on the element only for the purposes of scrolling and continuous zooming. Any additional behaviors supported by auto are out of scope for this specification.

R = React.DOM
nations = ['britain', 'ireland', 'norway', 'sweden', 'denmark', 'germany',
'holland', 'belgium', 'france', 'spain', 'portugal', 'italy', 'switzerland']
Typeahead = React.createClass
getInitialState : -> {input: ""}
handleChange : -> @setState input: @refs.field.getDOMNode().value
handleClick : (nation)-> @setState input: nation
matches : (input)->
@jollytoad
jollytoad / gist:4201905
Created December 4, 2012 08:44
Read a File using a FileReader returning a jQuery promise
function readFile(file) {
var reader = new FileReader();
var deferred = $.Deferred();
reader.onload = function(event) {
deferred.resolve(event.target.result);
};
reader.onerror = function() {
deferred.reject(this);
@roboshoes
roboshoes / touchmouse.js
Created April 13, 2012 10:43
This snippet maps mouse events and touch events onto one single event. This makes it easier in the code since you have to listen to only one event regardles whether it's desktop or mobile.
(function() {
/* == GLOBAL DECLERATIONS == */
TouchMouseEvent = {
DOWN: "touchmousedown",
UP: "touchmouseup",
MOVE: "touchmousemove"
}
/* == EVENT LISTENERS == */