Skip to content

Instantly share code, notes, and snippets.

View ariesjia's full-sized avatar
🍊
....

Jaap Chen ariesjia

🍊
....
View GitHub Profile
@ariesjia
ariesjia / ⚡️ Recent activity
Last active June 8, 2021 12:35
⚡️ Recent activity
💪 Opened PR #137 in ant-design/html2sketch
💪 Opened PR #136 in ant-design/html2sketch
💪 Opened PR #175 in FlowFans/flow-chinese-workshop
💪 Opened PR #146 in FlowFans/flow-chinese-workshop
💪 Opened PR #1 in AlayaNetwork/browser-web
@ariesjia
ariesjia / 📊 Weekly development breakdown
Last active October 24, 2019 12:04
📊 Weekly development breakdown
Cocoa 1 hr 38 mins ██████████▉░░░░░░░░░░ 52.3%
Swift 49 mins █████▌░░░░░░░░░░░░░░░ 26.5%
Java 30 mins ███▎░░░░░░░░░░░░░░░░░ 16.0%
SQL 7 mins ▉░░░░░░░░░░░░░░░░░░░░ 4.2%
Dart 1 min ▏░░░░░░░░░░░░░░░░░░░░ 1.0%
const saveCSV = (blob, filename) => {
const blob = new Blob(["\ufeff", blob], { type: ' type: "text/csv;charset=UTF-8"' })
saveAs(blob, `${filename}.csv`);
}
export const setAsyncRouteLeaveHook = (router, route, hook)=> {
let withinHook = false;
let finalResult = undefined;
let finalResultSet = false;
router.setRouteLeaveHook(route, nextLocation => {
withinHook = true
if (!finalResultSet) {
hook(nextLocation).then(result => {
finalResult = result
@ariesjia
ariesjia / safeApply.js
Created October 16, 2013 06:00
angular
// https://coderwall.com/p/ngisma
$scope.safeApply = function(fn) {
var phase = this.$root.$$phase;
if(phase == '$apply' || phase == '$digest') {
if(fn && (typeof(fn) === 'function')) {
fn();
}
} else {
this.$apply(fn);
}
@ariesjia
ariesjia / FE.txt
Created September 10, 2013 01:46
Tools
CSS3 生成工具
http://www.createcss3.com/
https://togetherjs.com/
https://www.firebase.com/
@ariesjia
ariesjia / directives.js
Created September 6, 2013 01:10
angular karma unit test
//
// test/unit/directives/directivesSpec.js
//
describe("Unit: Testing Directives", function() {
var $compile, $rootScope;
beforeEach(angular.mock.module('App'));
beforeEach(inject(
@ariesjia
ariesjia / IE hack
Created September 4, 2013 10:38
IE6 7 8 9 10 hack
To target IE 6 and 7
@media screen\9 {
body { background: red; }
}
To target IE 6, 7 and 8
@media \0screen\,screen\9 {
body { background: green; }
}
@ariesjia
ariesjia / angular e2e event trigger
Created September 4, 2013 09:05
angular e2e event trigger
element('#something_id').query(function(el, done){
var evt = document.createEvent('Event');
evt.initEvent('focus', false, true);
el[0].dispatchEvent(evt);
done();
});
@ariesjia
ariesjia / isType
Created August 29, 2013 06:34
js judge type
function isType(type) {
return function(obj) {
return {}.toString.call(obj) == "[object " + type + "]"
}
}
var isObject = isType("Object")
var isString = isType("String")
var isArray = Array.isArray || isType("Array")