Skip to content

Instantly share code, notes, and snippets.

View leecade's full-sized avatar
🎯
Focusing

斯人 leecade

🎯
Focusing
View GitHub Profile
@leecade
leecade / PinchZoomPan.js
Created November 8, 2016 19:05 — forked from iammerrick/PinchZoomPan.js
React Pinch + Zoom + Pan
import React from 'react';
const MIN_SCALE = 1;
const MAX_SCALE = 4;
const SETTLE_RANGE = 0.001;
const ADDITIONAL_LIMIT = 0.2;
const DOUBLE_TAP_THRESHOLD = 300;
const ANIMATION_SPEED = 0.04;
const RESET_ANIMATION_SPEED = 0.08;
const INITIAL_X = 0;
@leecade
leecade / Root.jsx
Created October 8, 2016 14:10 — forked from steida/Root.jsx
React Router 4 workaround for Link, Match, etc. inside pure component or Redux connect.
import BrowserHistory from 'react-history/BrowserHistory'
import React from 'react';
import Test from './Test';
import { Provider as Redux } from 'react-redux';
import { StaticRouter } from 'react-router';
import { connect } from 'react-redux';
import { setLocation } from '../../common/app/actions';
// Some component wrapped by pure container.
const Test = (props) => (
@leecade
leecade / immutable.js
Created August 19, 2016 21:43 — forked from esneko/immutable.js
Seamless Immutable
export default (state = initialState, action) => {
switch (action.type) {
case ADD_LOAN:
return state.merge({
loans: state.loans.concat([action.val])
})
case EDIT_LOAN:
return state.merge({
loans: state.loans.map((loan, id) =>
id === action.id ? loan.merge({
@leecade
leecade / DropZone.jsx
Created August 19, 2016 13:31 — forked from pizzarob/01_DropZone.jsx
HTML5 Drag and Drop React Component
import React, {PropTypes} from 'react';
import classNames from 'classnames';
class BatchDropZone extends React.Component {
static propTypes = {
// function that recieves an array of files
receiveFiles: PropTypes.func.isRequired,
var npm = require("npm");
var fs = require("fs-extra");
var chokidar = require("chokidar");
var packagePaths = [
"../mobile-app/node_modules/shared-package/lib",
"../web-app/node_modules/shared-package/lib",
];
var noop = () => {};
@leecade
leecade / uninstall_office_2011.sh
Last active July 6, 2016 15:02
uninstall_office_2011
#!/bin/sh
osascript -e 'tell application "Microsoft Database Daemon" to quit'
rm -R '/Applications/Microsoft Communicator.app/'
rm -R '/Applications/Microsoft Messenger.app/'
rm -R '/Applications/Microsoft Office 2011/'
rm -R '/Applications/Remote Desktop Connection.app/'
rm -R '/Library/Application Support/Microsoft/'
rm -R '/Library/Automator/*Excel*'
rm -R '/Library/Automator/*Office*'
rm -R '/Library/Automator/*Outlook*'
@leecade
leecade / Fastfile
Created June 28, 2016 17:43 — forked from kennydee/Fastfile
Fastfile for staging environment with Appetize.io on React Native (iOs & Android), with statuses update on Github Enterprise
require 'httparty'
fastlane_version "1.95.0"
default_platform :ios
before_all do
# put here your token and iOs scheme app
ENV["GITHUB_TOKEN"] = "---"
ENV["APPETIZE_TOKEN"] = "---"
ENV["APP_IOS_SCHEME"] = "---"
@leecade
leecade / node-install.sh
Created June 13, 2016 16:50 — forked from epety/node-install.sh
Nodejs installation script
#!/bin/bash
echo "Node Linux Installer by www.github.com/taaem"
if [[ $EUID -ne 0 ]]; then
echo "Need Root for installing NodeJS"
sudo sh -c 'echo "Got Root!"'
else
echo "Running as Root User"
fi