Skip to content

Instantly share code, notes, and snippets.

Lucas Paul L4grange

Block or report user

Report or block L4grange

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sonnguyen0310
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
mahmudahsan / ios_detect.swift
Last active Oct 2, 2018
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)
static let SCREEN_MAX_LENGTH = Int( max(SCREEN_WIDTH, SCREEN_HEIGHT) )
static let SCREEN_MIN_LENGTH = Int( min(SCREEN_WIDTH, SCREEN_HEIGHT) )
@WadeShuler
WadeShuler / killadobe.sh
Last active Jul 3, 2019
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
View killadobe.sh
#!/bin/bash
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
julianxhokaxhiu / create-iso.sh
Created Sep 24, 2016
Simple bash script to create a Bootable ISO from macOS Sierra Install Image from Mac App Store
View create-iso.sh
#!/bin/bash
#
# Credits to fuckbecauseican5 from https://www.reddit.com/r/hackintosh/comments/4s561a/macos_sierra_16a238m_install_success_and_guide/
# Adapted to work with the official image available into Mac App Store
#
# Enjoy!
hdiutil attach /Applications/Install\ macOS\ Sierra.app/Contents/SharedSupport/InstallESD.dmg -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
@rosterloh
rosterloh / gpio.java
Created Aug 18, 2014
Android class for GPIO control
View gpio.java
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
staltz / introrx.md
Last active Sep 17, 2019
The introduction to Reactive Programming you've been missing
View introrx.md
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Sep 12, 2019
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

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.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

View Xcode .gitignore
#####
# OS X temporary files that should never be committed
.DS_Store
*.swp
*.lock
profile
#####
# DotEnv files
.env
@yano3
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 user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@omz
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: http://f.cl.ly/items/3v0S3w2B3N0p3e0I082d/Image%202011.07.22%2011:29:25%20PM.png
//
// UIImage *buttonImage = [UIImage ipMaskedImageNamed:@"UIButtonBarAction.png" color:[UIColor redColor]];
// .h
@interface UIImage (IPImageUtils)
+ (UIImage *)ipMaskedImageNamed:(NSString *)name color:(UIColor *)color;
@end
You can’t perform that action at this time.