Skip to content

Instantly share code, notes, and snippets.

View a-eid's full-sized avatar
🎯
Focusing

Ahmed Eid a-eid

🎯
Focusing
View GitHub Profile
const fetch = require("isomorphic-fetch")
const endpoint = `https://talaikis.com/api/quotes/random/`
function* createGetQuote(){
const resp = yield fetch(endpoint)
const quote = yield resp.json()
return `${quote.quote}--${quote.author}`
}
const getQuote = createGetQuote()
## Install MongoDB on macOS Sierra
This procedure explains how to install [MongoDB](https://www.mongodb.org) using [Homebrew](http://brew.sh) on macOS Sierra 10.12.
Official MongoDB install documentation: [here](https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/)
### Install Homebrew
* Installing Homebrew is effortless, open Terminal and enter :
`$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"`
module.exports = {
parser: "babel-eslint",
env: {
browser: true,
commonjs: true,
es6: true,
node: true,
jest: true,
},
/*
@arr: array of 0s and 1s
@returns: an array of indexes
*/
const findIndexes = arr => {
return arr.reduce((m, e, i) => {
e && m.push(i)
return m
}, [])
}
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
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?) {
@a-eid
a-eid / 16:13
Created February 6, 2018 13:21
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
@a-eid
a-eid / 16:14
Created February 6, 2018 13:21
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] (
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!
@a-eid
a-eid / task.py
Last active November 19, 2017 18:31
import numbers
def numOrString(list):
cache = []
strings = []
nums = []
for n in list:
if(isinstance(n, numbers.Number)):
pass
cache.append(1)