Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

/*
The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in the set, which results in repetition of one number and loss of another number.
Given an array nums representing the data status of this set after the error. Your task is to firstly find the number occurs twice and then find the number that is missing. Return them in the form of an array.
Example 1:
Input: nums = [1,2,2,4]
Output: [2,3]
Note:
<div style="display: block; padding: 9.5px; margin: 0 0 10px; font-size: 15px; line-height: 1.42857143; color: #333; word-break: break-all; word-wrap: break-word; background-color: #f5f5f5; border: 1px solid #ccc; border-radius: 4px;">
some text here
</div>
@daoseng33
daoseng33 / gist:9a7316a73443f19fc9ef1b50ce237dfa
Created August 10, 2017 06:38
仿Nice tag 雷達閃爍動畫
#pragma mark -- Animation
//动画停止执行的delegate
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag
{
if ([[anim valueForKey:@"TransformScale"] isEqualToString:@"scaleAnimation"]) {
//清除上次的shapeLayer 防止内存泄露
for (CAShapeLayer *shapeLayer in shapeLayers) {
[shapeLayer removeAnimationForKey:kGroupAnimation];
[shapeLayer removeFromSuperlayer];
}
echo "\Clang-Format all files in current dir except ones in */libs/* folder and names containing *.framework.*"
find . -name "*.[hm]" ! -path "*/libs/*" ! -path "*.framework*" ! -path "*/ThirdParty/*" ! -path "*/Pods/*" -print0 | xargs -0 clang-format -i
echo "DONE"
@daoseng33
daoseng33 / .clang-format
Last active August 23, 2017 08:49
AlleyStore ObjC clang-format
---
# BasedOnStyle: LLVM
AccessModifierOffset: -2
ConstructorInitializerIndentWidth: 4
AlignEscapedNewlinesLeft: false
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
//
// UIImage+GIF.h
// LBGIFImage
//
// Created by Laurin Brandner on 06.01.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@daoseng33
daoseng33 / delete-feature-branches.sh
Created December 9, 2017 12:59 — forked from chrisjlee/delete-feature-branches.sh
Delete feature branch with prefix locally then remove all remote feature branches
# Stole from:
# http://stackoverflow.com/questions/32122784/alias-script-to-delete-all-local-and-remote-git-branches-with-a-specific-prefix
git branch -D $(printf "%s\n" $(git branch) | grep 'feature/')
# Or this will work too to remove all remote branches:
# https://coderwall.com/p/eis0ba/remove-a-thousand-stale-remote-branches-on-git
git branch -r | awk -F/ '/\/feature/{print $2}' | xargs -I {} git push origin :{}
# Prune all origin branches
git remote prune origin
@daoseng33
daoseng33 / type.swift
Last active June 28, 2018 12:46
Enum type
enum Type {
case regular
case system
case advertise
}
enum Type {
case regular
case system
case advertise
var image: UIImage? {
switch self {
case .regular:
return UIImage(named: "regular")
case .system:
enum Type: Int {
case regular = 0
case system
case advertise
var image: UIImage? {
switch self {
case .regular:
return UIImage(named: "regular")
case .system: