Skip to content

Instantly share code, notes, and snippets.

View ty0x2333's full-sized avatar
🎯
Focusing

Tian Yiyan ty0x2333

🎯
Focusing
View GitHub Profile
@jaredrummler
jaredrummler / SearchViewStyle.java
Last active May 22, 2020 22:48
Customize the SearchView in an ActionBar for Android
/*
* Copyright (C) 2015 Jared Rummler <jared.rummler@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@adrianorsouza
adrianorsouza / sublime-command-line.md
Last active September 26, 2023 16:26
launch sublime text from the command line

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@vratiu
vratiu / .bash_aliases
Last active May 6, 2024 17:58
Git shell coloring
# Customize BASH PS1 prompt to show current GIT repository and branch.
# by Mike Stewart - http://MediaDoneRight.com
# SETUP CONSTANTS
# Bunch-o-predefined colors. Makes reading code easier than escape sequences.
# I don't remember where I found this. o_O
# Reset
Color_Off="\[\033[0m\]" # Text Reset
@dignifiedquire
dignifiedquire / Dockerfile
Last active August 8, 2019 10:49
Dockerfile: Non root nvm setup.
# NVM as non root
#
# VERSION 0.1
FROM ubuntu
MAINTAINER Friedel Ziegelmayer <fziegelmayer@codio.com>
# Install dependencies
RUN apt-get update
RUN apt-get install git curl bzip2 -yy
@steventroughtonsmith
steventroughtonsmith / gist:7515380
Last active April 2, 2019 01:38
iOS 7 UIKeyCommand keydown/keyup and keycode input implementation for a UIResponder. Private API, of course…
-(BOOL)canBecomeFirstResponder
{
return YES;
}
-(UIKeyCommand *)_keyCommandForEvent:(UIEvent *)event // UIPhysicalKeyboardEvent
{
NSLog(@"keyCommandForEvent: %@\n\
type = %i\n\
keycode = %@\n\
@cobyism
cobyism / gh-pages-deploy.md
Last active May 6, 2024 08:07
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@briangriffey
briangriffey / NinePatchBitmapFactory.java
Last active April 25, 2023 03:06
Create 9-patches simlar to - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.NinePatch;
import android.graphics.Rect;
import android.graphics.drawable.NinePatchDrawable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
/**
@mattupstate
mattupstate / app.py
Created March 15, 2012 19:08
Flask application configuration using an environment variable and YAML
os
from flask_extended import Flask
app = Flask(__name__)
app.config.from_yaml(os.join(app.root_path, 'config.yml'))