Skip to content

Instantly share code, notes, and snippets.

:octocat:
.

Ahmed Eid a-eid

:octocat:
.
Block or report user

Report or block a-eid

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
View uicolor.swift
extension UIColor {
convenience init(hex: Int, alpha: CGFloat = 1.0) {
let r = CGFloat((hex >> 16) & 0xff) / 255
let g = CGFloat((hex >> 08) & 0xff) / 255
let b = CGFloat((hex >> 00) & 0xff) / 255
self.init(red: r, green: g, blue: b, alpha: alpha)
} }
// usage
View Anchors.swift
import UIKit
extension UIView {
// top bottom left and right
func anchorEdges(top: NSLayoutYAxisAnchor?, tConst: CGFloat = 0,
left: NSLayoutXAxisAnchor?, lConst: CGFloat = 0 ,
right: NSLayoutXAxisAnchor?, rConst: CGFloat = 0 ,
bottom: NSLayoutYAxisAnchor?, bConst: CGFloat = 0
) -> (NSLayoutConstraint?, NSLayoutConstraint?, NSLayoutConstraint?, NSLayoutConstraint?) {
View 16:13
Feb 6 16:13:29 192 Memory Purge[4693]: [error] Connection failed. Server error., not found
Feb 6 16:13:29 192 Memory Purge[4693]: [info] Status was: 404
Feb 6 16:13:29 192 Memory Purge[4693]: [info] ATAPIRequest failed: Server error., not found
Feb 6 16:13:45 192 com.apple.xpc.launchd[1] (com.apple.WindowServer[4368]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
Feb 6 16:13:46 192 sessionlogoutd[13366]: DEAD_PROCESS: 4367 console
Feb 6 16:13:46 192 com.apple.xpc.launchd[1] (com.apple.auditd[13367]): Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.auditd
Feb 6 16:13:46 192 aeid[13372]: audit warning: soft /var/audit
Feb 6 16:13:46 192 aeid[13371]: audit warning: allsoft
Feb 6 16:13:46 192 aeid[13374]: audit warning: closefile /var/audit/20180206130416.20180206131346
Feb 6 16:13:48 ahmeds-mbp findmydeviced[13376]: objc[13376]: Class LocalizedUnregisterErrorKey is implemented in both /System/Library/Priv
View 16:14
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.user.loginwindow.13375.4294967295): com.apple.AssistiveControl (lint): The HideUntilCheckIn property is an architectural performance issue. Please transition away from it.
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (com.apple.coreservices.useractivityd): Unknown key for Boolean: DrainMessagesAfterFailedInit
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (com.apple.coreservices.UASharedPasteboardProgressUI): Unknown key for Boolean: DrainMessagesAfterFailedInit
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.user.loginwindow.13375.4294967295): com.apple.DwellControl (lint): The HideUntilCheckIn property is an architectural performance issue. Please transition away from it.
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (com.apple.imklaunchagent): This service is defined to be constantly running and is inherently inefficient.
Feb 6 16:14:09 ahmeds-mbp com.apple.xpc.launchd[1] (
View code.swift
import UIKit
class Second: UIViewController {
@IBOutlet weak var trigger: RoundButton!
@IBOutlet weak var right: RoundButton!
@IBOutlet weak var left: RoundButton!
@IBOutlet weak var top: RoundButton!
var clicked = false
var rightCenter: CGPoint!
View task.py
import numbers
def numOrString(list):
cache = []
strings = []
nums = []
for n in list:
if(isinstance(n, numbers.Number)):
pass
cache.append(1)
View formatWithSuffix.js
window.formatWithSuffix = function(input){
suffixes = ['', 'k', 'm', 'g', 't'];
suffixIndex = 0;
while( Math.abs(input) >= 1000 && suffixIndex < suffixes.length ){
suffixIndex++;
input /= 1000;
}
return (
View tmux.config
#rebind C-b => C-a
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
View layout_new.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
* {
View new_layout.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<style>
* {
box-sizing: border-box;
You can’t perform that action at this time.