Skip to content

Instantly share code, notes, and snippets.

View lanqy's full-sized avatar
🎯
Focusing

Lan Qingyong lanqy

🎯
Focusing
  • Shenzhen,China
View GitHub Profile
//
// CoreTextLabel.h
// Frost
//
// Created by David Kasper on 10/1/12.
//
#import <UIKit/UIKit.h>
#import <CoreText/CoreText.h>
//
// UIView+frameAdjust.h
// fenbi
//
// Created by Tang Qiao on 12-5-31.
// Copyright (c) 2012年 Fenbi.com . All rights reserved.
//
#import <Foundation/Foundation.h>
@lanqy
lanqy / gist:8514345
Created January 20, 2014 03:16
How to detect Safari, Chrome, IE, Firefox and Opera browser?
//from http://stackoverflow.com/questions/9847580/how-to-detect-safari-chrome-ie-firefox-and-opera-browser
var isOpera = !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
// Opera 8.0+ (UA detection to detect Blink/v8-powered Opera)
var isFirefox = typeof InstallTrigger !== 'undefined'; // Firefox 1.0+
var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
// At least Safari 3+: "[object HTMLElementConstructor]"
var isChrome = !!window.chrome && !isOpera; // Chrome 1+
var isIE = /*@cc_on!@*/false || !!document.documentMode; // At least IE6
@lanqy
lanqy / gist:8523817
Last active January 3, 2016 21:48
通过索引选中table cell
//select first row of first section
// from http://stackoverflow.com/questions/5918309/how-to-programmatically-tap-a-uitableview-cell
// from http://stackoverflow.com/questions/6118071/how-to-set-row-selected-by-default-in-uitableview
NSIndexPath* selectedCellIndexPath= [NSIndexPath indexPathForRow:0 inSection:0];
[self.tableView selectRowAtIndexPath:selectedCellIndexPath animated:false scrollPosition:UITableViewScrollPositionMiddle];
//
// NSObject+Blocks.h
// Filemator
//
// Created by Zachary Waldowski on 4/12/11.
// Copyright 2011 Dizzy Technology. All rights reserved.
//
@interface NSObject (Blocks)
//
// ViewController.swift
// TestSwift
//
// Created by Jameson Quave on 6/2/14.
// Copyright (c) 2014 JQ Software LLC. All rights reserved.
//
import UIKit
@lanqy
lanqy / gist:a6a9b1c411320de046a4
Last active September 4, 2015 03:00 — forked from shannoga/gist:1008678
Get fonts family and font names list on iOS
// List all fonts on iPhone
NSArray *familyNames = [[NSArray alloc] initWithArray:[UIFont familyNames]];
NSArray *fontNames;
NSInteger indFamily, indFont;
for (indFamily=0; indFamily<[familyNames count]; ++indFamily)
{
NSLog(@"Family name: %@", [familyNames objectAtIndex:indFamily]);
fontNames = [[NSArray alloc] initWithArray:
[UIFont fontNamesForFamilyName:
[familyNames objectAtIndex:indFamily]]];
@lanqy
lanqy / .babelrc
Created July 24, 2016 04:16 — forked from thaerlabs/.babelrc
React hello world is not hard
{
"presets": ["es2015", "react"]
}
@lanqy
lanqy / redux-form-tut.js
Created August 22, 2016 02:04 — forked from dmeents/redux-form-tut.js
The source code for the redux form tutorial on davidmeents.com
import React, { Component } from 'react';
import { Field, reduxForm } from 'redux-form';
import { connect } from 'react-redux';
import * as actions from '../../actions';
const form = reduxForm({
form: 'ReduxFormTutorial',
validate
});
@lanqy
lanqy / Child.js
Created August 24, 2016 03:14 — forked from eyesofkids/Child.js
Simple React Lifecycle methods test
import React from 'react'
var Child = React.createClass({
getInitialState: function(){
console.log('Child getInitialState');
return { value: 'start'}
},
getDefaultProps: function(){
console.log('Child getDefaultProps');