Skip to content

Instantly share code, notes, and snippets.

Basem Emara basememara

Block or report user

Report or block basememara

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 SynchronizedArray.swift
import Foundation
import PlaygroundSupport
/// A thread-safe array.
public class SynchronizedArray<Element> {
private let queue = DispatchQueue(label: "io.zamzam.ZamzamKit.SynchronizedArray", attributes: .concurrent)
private var array = [Element]()
public init() { }
@basememara
basememara / Badge.swift
Last active Aug 6, 2018 — forked from yonat/Badge.swift
Rounded UILabel and UIButton, Badged UIBarButtonItem
View Badge.swift
//
// Badge.swift
// Extensions for Rounded UILabel and UIButton, Badged UIBarButtonItem.
//
// Usage:
// let label = UILabel(badgeText: "Rounded Label");
// let button = UIButton(type: .System); button.rounded = true
// let barButton = UIBarButtonItem(badge: "42", title: "How Many Roads", target: self, action: "answer")
//
// Created by Yonat Sharon on 06.04.2015.
View iOSSwiftPrepareSegue.swift
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
guard let row = self.tableView.indexPathForSelectedRow?.row,
let identifier = segue.identifier else { return }
switch (identifier, segue.destinationViewController) {
case (SPPostDetailViewController.segueIdentifier, let controller as SPPostDetailViewController):
controller.model = models[row]
default: return
}
}
@basememara
basememara / gist:5420184
Last active Dec 16, 2015
SF MVC Navigation View (2-level)
View gist:5420184
@model SitefinityWebApp.Mvc.Models.NavigationViewModel
@if (Model.DisplayParentTitle)
{
@Html.Raw(string.Format(Model.TitleFormat, Model.RootPage.Title))
}
<ul class="@Model.CssClass">
@for (int i = 0; i < Model.RootPage.Items.Count; i++)
{
@basememara
basememara / main.js
Created Feb 27, 2013
RequireJS: Avoid double jQuery load and version conflict in main.js
View main.js
;(function () {
var paths = { ... };
//HANDLE JQUERY IF LOADED ALREADY TO AVOID OVERWRITING EXISTING JQUERY PROPERTIES AND PLUGINS
//CHECK FOR OLD VERSIONS OF JQUERY
var oldjQuery = !!(window.jQuery && !!window.jQuery.fn.jquery.match(/^1\.[0-4]/));
//LOAD JQUERY IF NOT AVAILABLE OR BELOW MIN
if (!window.jQuery || oldjQuery) {
paths.jquery = [
View app.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<title>App name goes here</title>
<!-- Load some CSS here. -->
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<!-- Optional part. Define some global opts. You can set these easily via PHP or so. -->
You can’t perform that action at this time.