Skip to content

Instantly share code, notes, and snippets.

View hjue's full-sized avatar

hjue hjue

  • Beijing, China
View GitHub Profile
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
// tries to execute the uri:scheme
function uriSchemeWithHyperlinkFallback(uri, href) {
// set up a timer and start it
var start = new Date().getTime(),
end,
elapsed;
// attempt to redirect to the uri:scheme
// the lovely thing about javascript is that it's single threadded.
// if this WORKS, it'll stutter for a split second, causing the timer to be off
@hjue
hjue / hd.txt
Last active August 29, 2015 14:22 — forked from EkkoG/hd.txt
http://devstreaming.apple.com/videos/wwdc/2015/2048w4vdjhe1i1m/204/204_hd_apple_watch_accessibility.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/213w6grumlfm0q/213/213_hd_building_apps_with_researchkit.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/209c9277tttlt9/209/209_hd_creating_complications_with_clockkit.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/2058z3fx76huw93/205/205_hd_getting_started_with_multitasking_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/214dh5q5d0kswh/214/214_hd_introducing_on_demand_resources.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/5048tyhotl6/504/504_hd_introducing_safari_view_controller.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/211dseo3cn0bnw/211/211_hd_multitasking_essentials_for_mediabased_apps_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/2015/212mm5ra3oau66/212/212_hd_optimizing_your_app_for_multitasking_on_ipad_in_ios_9.mp4?dl=1
http://devstreaming.apple.com/videos/wwdc/
@hjue
hjue / _elements.html
Last active August 29, 2015 14:25 — forked from Kevinlearynet/_elements.html
Static Site Engines with Node + Express Code Samples
# Elements
Fundamental building blocks of MIT Technology Review's digital styles.
## Doctype
{{ organization }} makes use of certain HTML elements and CSS properties that require the use of the HTML5 doctype. Include it at the beginning of all your projects.
### HTML
```html
<!DOCTYPE html>
<html lang="en">
@hjue
hjue / install_spark_centos7.sh
Last active July 29, 2016 06:53 — forked from darcyliu/install_spark_centos7.sh
Install Spark on CentOS 7
#!/bin/bash
# Install Spark on CentOS 7
yum install java -y
java -version
yum install wget -y
wget http://downloads.typesafe.com/scala/2.11.8/scala-2.11.8.tgz
tar xvf scala-2.11.8.tgz
sudo mv scala-2.11.8 /usr/lib
sudo ln -s /usr/lib/scala-2.11.8 /usr/lib/scala
@hjue
hjue / solving_spark_signature_error.md
Created August 15, 2016 04:09 — forked from hkhamm/solving_spark_signature_error.md
Solving a Spark Invalid signature file digest for Manifest main attributes error

##Solving a Spark error: Invalid signature file digest for Manifest main attributes

When using spark-submit to run a jar, you may encounter this error:

Invalid signature file digest for Manifest main attributes

The error occurs when one of the included libraries in the jar's META-INF directory has a bad signature.

@hjue
hjue / Stackedit.md
Created November 2, 2016 14:37 — forked from nztim/Stackedit.md
Install StackEdit on Ubuntu 14.04

###Install Node and Bower

  • Set up the NodeSource repo and install Node
  • curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash -
  • sudo apt-get install nodejs
  • Install bower: sudo npm install -g bower

Install StackEdit

  • Clone the repo: git clone https://github.com/benweet/stackedit
  • To use a domain other than 'localhost', edit /public/res/constants.js:
  • constants.BASE_URL = "http://stackedit.dev:3000/";
@hjue
hjue / on-jsx.markdown
Created December 9, 2016 06:32 — forked from chantastic/on-jsx.markdown
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I lead the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can'

@hjue
hjue / gist:4a7c841a5b594cdb655191390e5962da
Created July 25, 2017 03:06
Adding a header in Revel
type Api struct {
*revel.Controller
}
func addHeaderCORS(c *revel.Controller) revel.Result {
c.Response.Out.Header().Add("Access-Control-Allow-Origin","*")
return nil
}
func init() {
@hjue
hjue / ffmpeg-mkv-to-mp4.sh
Created October 20, 2017 14:15 — forked from pwenzel/ffmpeg-mkv-to-mp4.sh
MKV and AVI to MP4 Conversion for Apple TV
# See also https://trac.ffmpeg.org/wiki/Encode/AAC
# direct copy
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
# direct copy video, but convert audio to AAC with default variable bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental output.mp4
# direct copy video, but convert audio to AAC with constant bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 320k output.mp4