Skip to content

Instantly share code, notes, and snippets.

View zhigang1992's full-sized avatar
:octocat:
Focusing

Kyle zhigang1992

:octocat:
Focusing
View GitHub Profile
@anthonyshort
anthonyshort / gist:1178298
Created August 29, 2011 12:31
Prefixing with Sass
@mixin border-radius($radius, $prefixes: -moz -webkit -o) {
@each $prefix in $prefixes {
#{$prefix}-border-radius:$radius;
}
border-radius:$radius;
}
#id {
@include border-radius(5px, -moz -webkit);
@sorted-bits
sorted-bits / SBCircleProgressBar.h
Created November 19, 2011 07:19
A circle as progressbar
//
// SBCircleProgressBar.h
//
// Created by Wim Haanstra on 17-11-11.
// Copyright (c) 2011 Sorted Bits. All rights reserved.
//
@interface SBCircleProgressBar : UIView
// The maximum value of the progressbar
@Moligaloo
Moligaloo / RevertPngCrush.py
Created January 30, 2013 08:29
Revert png files that are compressed by Apple's pngcrush tool, the original code is from http://axelbrz.com.ar/?mod=iphone-png-images-normalizer
#---
# iPIN - iPhone PNG Images Normalizer v1.0
# Copyright (C) 2007
#
# Author:
# Axel E. Brzostowski
# http://www.axelbrz.com.ar/
# axelbrz@gmail.com
#
# References:
@lucifr
lucifr / private.xml
Created February 17, 2013 16:00
My KeyRemap4MacBook private.xml
<?xml version="1.0"?>
<root>
<item>
<name>F19 to F19</name>
<appendix>(F19 to Hyper (ctrl+shift+cmd+opt) + F19 Only, F19)</appendix>
<identifier>private.f192f19</identifier>
<autogen>
--KeyOverlaidModifier--
KeyCode::F19,
KeyCode::COMMAND_L,
@goshacmd
goshacmd / fix_sys_rb.sh
Created June 12, 2013 07:41
OS X [REDACTED] Ruby 2.0 headers fix.
sys_rb_usr=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sdk_rb_usr=`xcode-select -p`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr
sudo cp -r $sdk_rb_usr/include $sys_rb_usr/include
@cobbal
cobbal / monad.swift
Last active April 6, 2016 04:40
Monad protocol in swift
protocol Monad {
typealias F
typealias U
class func bind<M : Monad where M.U == U>(Self, F -> M) -> M
class func `return`(F) -> Self
}
extension Array : Monad {
typealias F = T
@carcinocron
carcinocron / debugger pause beforeunload
Last active July 10, 2024 08:48
Chrome: pause before redirect
// Run this in the F12 javascript console in chrome
// if a redirect happens, the page will pause
// this helps because chrome's network tab's
// "preserve log" seems to technically preserve the log
// but you can't actually LOOK at it...
// also the "replay xhr" feature does not work after reload
// even if you "preserve log".
window.addEventListener("beforeunload", function() { debugger; }, false)
@yuhua-chen
yuhua-chen / Drag-and-drop-uitableviewcell-swift2.swift
Created August 6, 2015 09:12
Demo the drag and drop UITableViewCell in Swift 2.
struct Drag {
static var placeholderView: UIView!
static var sourceIndexPath: NSIndexPath!
}
func handleLongPress(gesture: UILongPressGestureRecognizer) {
let point = gesture.locationInView(tableView)
let indexPath = tableView.indexPathForRowAtPoint(point)
switch gesture.state {
@gbaman
gbaman / HowToOTGFast.md
Last active July 19, 2024 23:49
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

@hktonylee
hktonylee / index.d.ts
Created November 27, 2016 16:50
Typescript Typing Definition for react-native-fbsdk
declare module "react-native-fbsdk" {
export interface LoginResult {
isCancelled: boolean,
grantedPermissions?: Array<string>,
declinedPermissions?: Array<string>,
}
export type DefaultAudience = 'friends' | 'everyone' | 'only_me';
export type LoginBehaviorIOS = 'native' | 'browser' | 'system_account' | 'web';