Skip to content

Instantly share code, notes, and snippets.

View shuhankuang's full-sized avatar

S shuhankuang

View GitHub Profile
@shuhankuang
shuhankuang / repo-reset.md
Created October 11, 2020 02:30 — forked from heiswayi/repo-reset.md
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@shuhankuang
shuhankuang / gist:9735279
Created March 24, 2014 06:43
ubuntu 安装 nginx
Nginx is included in the Ubuntu software repositories. While using this method will leave you with a working web server it is not the preferred method for installing nginx. Nevertheless, if you want to install in this manner, the following sequence of commands ensure that your system's package databases and installed programs are up to date:
add-apt-repository ppa:nginx/stable
apt-get update
apt-get upgrade --show-upgraded
Install the nginx web server by issuing the following command:
apt-get install nginx
To start the server for the first time use the following command:
//
// CCamera.h
// CCamera
//
// Created by Jonathan Wight on 7/12/12.
// Copyright (c) 2012 Jonathan Wight. All rights reserved.
//
#import <Foundation/Foundation.h>
@shuhankuang
shuhankuang / gist:7558275
Created November 20, 2013 05:37
air 下载然后缓存文件
public static function HasCache(CacheKey:String):Boolean {
var f:File = File.applicationStorageDirectory.resolvePath("cache/" + CacheKey);
return f.exists;
f = null;
}
public static function PutInCache(CacheKey:String, data:ByteArray):void {
var f:File = File.applicationStorageDirectory.resolvePath("cache/" + CacheKey);
var fs:FileStream = new FileStream();
- (void)shakeView:(UIView *)viewToShake
{
CGFloat t = 2.0;
CGAffineTransform translateRight = CGAffineTransformTranslate(CGAffineTransformIdentity, t, 0.0);
CGAffineTransform translateLeft = CGAffineTransformTranslate(CGAffineTransformIdentity, -t, 0.0);
viewToShake.transform = translateLeft;
[UIView animateWithDuration:0.07 delay:0.0 options:UIViewAnimationOptionAutoreverse|UIViewAnimationOptionRepeat animations:^{
[UIView setAnimationRepeatCount:2.0];
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- <meta />
Use meta nodes to set metadata for your application. The description is ignored
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets.
For compatibility with Android and webOS, the package name must include at least