Skip to content

Instantly share code, notes, and snippets.

View yunus-alkan's full-sized avatar

Yunus Alkan yunus-alkan

View GitHub Profile
import { PLATFORM_ID } from '@angular/core';
import { isPlatformBrowser } from '@angular/common';
@Component({...})
export class DemoComponent implements OnInit {
constructor(@Inject(PLATFORM_ID) private platformId: Object) { }
ngOnInit() {
if (isPlatformBrowser(this.platformId)){
// here you can access window
console.log(window);
require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = "react-native-navigation"
s.version = package['version']
s.summary = "React-native navigation solution"
s.authors = { "Wix" => "Wix" }
@aryaxt
aryaxt / RawRepresentableExtension
Last active April 19, 2018 08:31
Swift enum -> Get an array of all cases
extension RawRepresentable where Self: Hashable {
private static func iterateEnum<T: Hashable>(_: T.Type) -> AnyIterator<T> {
var index = 0
let closure: () -> T? = {
let next = withUnsafePointer(to: &index) {
$0.withMemoryRebound(to: T.self, capacity: 1) { $0.pointee }
}
guard next.hashValue == index else { return nil }