Skip to content

Instantly share code, notes, and snippets.

View aalenliang's full-sized avatar
💩
Shituation

Alen Liang aalenliang

💩
Shituation
View GitHub Profile
@jbgo
jbgo / git-recover-branch.md
Last active May 23, 2024 12:29
How to recover a git branch you accidentally deleted

UPDATE: A better way! (August 2015)

As pointed out by @johntyree in the comments, using git reflog is easier and more reliable. Thanks for the suggestion!

 $ git reflog
1ed7510 HEAD@{1}: checkout: moving from develop to 1ed7510
3970d09 HEAD@{2}: checkout: moving from b-fix-build to develop
1ed7510 HEAD@{3}: commit: got everything working the way I want
70b3696 HEAD@{4}: commit: upgrade rails, do some refactoring
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@SeanZoR
SeanZoR / detectWebGL.js
Created August 20, 2015 12:48
Detect WebGL with JS in browser
/**
* Detects if WebGL is enabled.
* Inspired from http://www.browserleaks.com/webgl#howto-detect-webgl
*
* @return { number } -1 for not Supported,
* 0 for disabled
* 1 for enabled
*/
function detectWebGL()
{
@nvkiet
nvkiet / gist:29e4d5b5bef0865ee159
Created September 24, 2015 07:53
UIAlertController TextAlignment
if #available(iOS 8.0, *) {
let alertController = UIAlertController(title: "Terms & Conditions", message: kTermsAndConditions, preferredStyle: .Alert)
let OKAction = UIAlertAction(title: "OK", style: .Cancel) { (action) in
alertController.dismissViewControllerAnimated(true, completion: nil)
}
alertController.addAction(OKAction)
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.alignment = NSTextAlignment.Left
@speaktoalvin
speaktoalvin / IAPHelper.txt
Last active April 29, 2021 04:07
In App Purchase in Swift, with Receipt Validation
import UIKit
import StoreKit
//MARK: SKProductsRequestDelegate
extension IAPHelpers : SKProductsRequestDelegate
{
func productsRequest(request: SKProductsRequest, didReceiveResponse response: SKProductsResponse)
{
@tadija
tadija / Xcode Semi-Automatic Versioning.md
Last active August 11, 2022 19:55
Xcode Semi-Automatic Versioning | Bump Build Number | Bump Version Number

Xcode Semi-Automatic Versioning

Instructions:

First Things First

In order for agvtool to work properly you must first set
Project Settings / Build Settings / Versioning / Versioning System to Apple Generic.

Bump Build Number

  1. Create new shared scheme 'Bump Build Number'
@okonet
okonet / jest-webpack-preprocessor.js
Created March 9, 2017 09:29
Test webpack-shimmed and aliased modules with Jest
/* eslint-env node */
const path = require('path');
const webpack = require('webpack');
const MemoryFileSystem = require('memory-fs');
const EnhancedResolve = require('enhanced-resolve');
const transform = require('transform-jest-deps');
const babel = require('babel-jest');
const createConfig = require('../build/utils/createWebpackConfig');