Skip to content

Instantly share code, notes, and snippets.


Lucas Paul L4grange

  • Greece
View GitHub Profile
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)
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)
WadeShuler /
Last active Aug 13, 2021
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n"
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist
echo "\n\n--- Done! ---\n\n"
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
lopspower /
Last active Sep 28, 2021
Hexadecimal color code for transparency

Hexadecimal color code for transparency


How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

liangzhitao /
Last active Sep 8, 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;

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 {
staltz /
Last active Sep 27, 2021
The introduction to Reactive Programming you've been missing
DanHerbert /
Last active Sep 17, 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.

bojan / Xcode .gitignore
Last active Feb 28, 2021
Git ignore list for Xcode development related files
View Xcode .gitignore
# --------------------------------
# macOS temporary files
# --------------------------------
# --------------------------------
# Xcode
# --------------------------------