Skip to content

Instantly share code, notes, and snippets.

View Aufree's full-sized avatar
:octocat:
>(0.0)<

Aufree Aufree

:octocat:
>(0.0)<
  • Freelancer
  • ShenZhen, China
View GitHub Profile
@Aufree
Aufree / config.js
Last active August 29, 2015 14:07
The basic configuration of easy-emoji
$(function(){
emojify.setConfig({
img_dir: '/images/emoji',
ignored_tags: {
'SCRIPT': 1,
'TEXTAREA': 1,
'A': 1,
'PRE': 1,
'CODE': 1
}
@Aufree
Aufree / ImagePreview.js
Created October 10, 2014 13:07
Preview image before uploading in jquery
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
$('#previewHolder').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
@Aufree
Aufree / NSString_Filter_Emoji
Created March 5, 2015 03:17
Filter all emoji from nsstring
- (NSString*)removeEmoji:(NSString *)username {
__block NSMutableString* temp = [NSMutableString string];
[username enumerateSubstringsInRange:NSMakeRange(0, [username length]) options:NSStringEnumerationByComposedCharacterSequences usingBlock:
^(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop) {
const unichar hs = [substring characterAtIndex: 0];
// surrogate pair
if (0xd800 <= hs && hs <= 0xdbff) {
@Aufree
Aufree / awesomeGif.sh
Last active August 29, 2015 14:20
利用 QuickTime Player 和 FFmpeg 生成高质量的 Gif 图
palette="./palette.png"
filters="fps=30,scale=320:-1:flags=lanczos"
ffmpeg -v warning -i $1 -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i $1 -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y $2
# palette.png 可以从这里下载: http://ww4.sinaimg.cn/large/76dc7f1bgw1erny806ga9j200g00g0jo.jpg 请改名为 palette.png
# fps 越高越流畅, 但体积会越大
# 使用方法, 运行: ./awesomeGif.sh welcome.mov welcome.gif
@Aufree
Aufree / Fuck_GitHub_New_NavigationBar.html
Last active August 29, 2015 14:22
Fuck GitHub New NavigationBar
<div class="header header-logged-in true" role="banner">
<div class="container clearfix">
<a class="header-logo-invertocat" href="https://github.com/" data-hotkey="g d" aria-label="Homepage" data-ga-click="Header, go to dashboard, icon:logo">
<span class="mega-octicon octicon-mark-github"></span>
</a>
<div class="site-search repo-scope js-site-search" role="search">
<form accept-charset="UTF-8" action="/" class="js-site-search-form" data-global-search-url="/search" data-repo-search-url="/" method="get"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="✓"></div>
@implementation ViewController
- (void)viewDidLoad{
_showCoverImage.contentMode = UIViewContentModeScaleAspectFit;
_showCoverImage.image = [self imageWithBlurredImageWithImage:_showCoverImage.image andBlurInsetFromBottom: 200 withBlurRadius:3];
}
- (UIImage*)imageWithBlurredImageWithImage:(UIImage*)image andBlurInsetFromBottom:(CGFloat)bottom withBlurRadius:(CGFloat)blurRadius{
UIGraphicsBeginImageContext(image.size);
CGContextRef context = UIGraphicsGetCurrentContext();
@Aufree
Aufree / DidSelectTabBar.m
Created October 27, 2015 02:43
Did select tababr
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
id nc = viewController;
id vc = [[nc viewControllers] objectAtIndex:0];
static UIViewController *previousController = nil;
if (previousController == viewController) {
if ([vc isKindOfClass:[TopicListViewController class]]) {
}
}
@Aufree
Aufree / keymap.cson
Last active August 14, 2016 01:25
Backup atom keymap.cson file
# Beautify shortcut
'atom-text-editor':
'shift-cmd-h': 'atom-beautify:beautify-editor'
# Alignment shortcut
'.platform-darwin atom-text-editor':
'ctrl-cmd-t': 'atom-alignment:alignMultiple'
# Will make autocomplete trigger with 'enter' instead of 'tab'
'atom-text-editor:not(mini) .autocomplete-plus.autocomplete-suggestion-list':
/*
* NOTE:
* - The use of browser-specific styles (-moz-, -webkit-) should be avoided.
* If used, they may not render correctly for people reading the email in
* a different browser than the one from which the email was sent.
* - The use of state-dependent styles (like a:hover) don't work because they
* don't match at the time the styles are made explicit. (In email, styles
* must be explicitly applied to all elements -- stylesheets get stripped.)
*/
#!/usr/bin/bash
while read repo
do curl -X DELETE -H "Authorization: token GITHUB_TOKEN" "https://api.github.com/repos/$repo"
done < repos.txt