Skip to content

Instantly share code, notes, and snippets.


Lucas Paul L4grange

  • Greece
View GitHub Profile
omz / gist:1102091
Created Jul 24, 2011 — forked from marcoarment/gist:1100959
Creating arbitrarily-colored icons from a black-with-alpha master image (iOS)
View gist:1102091
// Usage example:
// input image:
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
bojan / Xcode .gitignore
Last active Feb 28, 2021
Git ignore list for Xcode development related files
View Xcode .gitignore
# --------------------------------
# macOS temporary files
# --------------------------------
# --------------------------------
# Xcode
# --------------------------------
rosterloh /
Created Aug 18, 2014
Android class for GPIO control
public class GPIO {
public String port;
public int pin;
//get direction of gpio
public String getInOut()
String command = String.format("cat /sys/class/gpio/%s/direction",this.port);
try {
sonnguyen0310 / gist:6720cbf39ce877c20fea1a987543fb99
Created Jul 2, 2018
iOS 11: Change size of UIBarButtonItem (image) in Swift 3
View gist:6720cbf39ce877c20fea1a987543fb99
func setUpMenuButton(){
let menuBtn = UIButton(type: .custom)
menuBtn.frame = CGRect(x: 0.0, y: 0.0, width: 20, height: 20)
menuBtn.setImage(UIImage(named:"menuIcon"), for: .normal)
menuBtn.addTarget(self, action: #selector(vc.onMenuButtonPressed(_:)), for: UIControlEvents.touchUpInside)
let menuBarItem = UIBarButtonItem(customView: menuBtn)
let currWidth = menuBarItem.customView?.widthAnchor.constraint(equalToConstant: 24)
currWidth?.isActive = true
let currHeight = menuBarItem.customView?.heightAnchor.constraint(equalToConstant: 24)
DanHerbert /
Last active Jun 22, 2021
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

mahmudahsan / ios_detect.swift
Last active Jul 9, 2021
iPhone X and other iOS device detection by Swift and Objective-C
View ios_detect.swift
struct Device {
// iDevice detection code
static let IS_IPAD = UIDevice.current.userInterfaceIdiom == .pad
static let IS_IPHONE = UIDevice.current.userInterfaceIdiom == .phone
static let IS_RETINA = UIScreen.main.scale >= 2.0
static let SCREEN_WIDTH = Int(UIScreen.main.bounds.size.width)
static let SCREEN_HEIGHT = Int(UIScreen.main.bounds.size.height)
liangzhitao /
Last active Jul 14, 2021
Add column spacing in RecyclerView with GridLayoutManager

Android Recyclerview GridLayoutManager column spacing Here is the question, the first answer does not work well in my project,and it makes the spacing bigger between item and item. the second answer is quite perfect.But if RecyclerView has headers,it does not work well. Then I fixed it.

import android.view.View;

alexeds /
Created Sep 5, 2012
Move your stashes from one repo to another

Move your stashes from one repo to another

This was useful for me when we created a new branch for a new major release, but were still working on our current version as well. I cloned our repo again and kept the new project on our new branch, but also wanted to get my stashes there.

Download your stashes

git stash show -p > patch

You'll have to specify your stash and name your file whatevery you want. Do this for as all your stashes, and you'll have patch files in your pwd.

julianxhokaxhiu /
Created Sep 24, 2016
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
# Credits to fuckbecauseican5 from
# Adapted to work with the official image available into Mac App Store
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ -noverify -nobrowse -mountpoint /Volumes/install_app
hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
yano3 / gist:1378948
Created Nov 19, 2011
git commit --amend --reset-author
View gist:1378948
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global "Your Name"
git config --global
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author