Skip to content

Instantly share code, notes, and snippets.

View BafS's full-sized avatar

Fabien Salathe BafS

View GitHub Profile
@monyschuk
monyschuk / NSPopover_OverrideAnimation.h
Created February 8, 2022 01:26
disables all animation of NSPopover (for use in SwiftUI apps where there is no control over popover display animation
//
// NSPopover_OverrideAnimation.h
// scrl (macOS)
//
// Created by Mark Onyschuk on 2022-02-07.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@ospfranco
ospfranco / WebImage.swift
Created January 16, 2022 12:44
React Native macOS Draggable SDWebImage
import Cocoa
import SDWebImage
class InternalWebImage: NSView, NSDraggingSource, NSPasteboardItemDataProvider {
let image = NSImageView()
@objc var url: NSString = "" {
didSet {
self.setupView()
}

Angular2 + JSPM cheat sheet

First time setup

  • install jspm beta: npm install -g jspm@beta
  • set up your project: jspm init
  • install dependencies: jspm install angular2 reflect-metadata zone.js es6-shim

This will create a jspm_packages folder, and a config.js file.

Open the config.js file - this file manages options for the System.js loader - tweak it as appropriate

@takeshixx
takeshixx / hb-test.py
Last active July 4, 2024 03:29
OpenSSL heartbeat PoC with STARTTLS support.
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
@weotch
weotch / Laravel 4: Service Providers and Facades.md
Last active December 15, 2019 01:55
Laravel 4: Service Providers and Facades

Lets look at how Facades work in Laravel 4 by investigating the flow of one of the facaded classes: URL. As in <?=URL::route('news')?>.

The logic flow

As you'll see in the summary, this isn't exactly described in the procedural order your app is executed. But I think it serves to explain what's going on.

  1. The app config has an aliases array. In there is: 'URL' => 'Illuminate\Support\Facades\URL'. If you look up that class, you'll see it just has this: protected static function getFacadeAccessor() { return 'url'; } and that it inherits from Illuminate\Support\Facades\Facade. We'll get back to this later.

  2. Lets now turn to how the app boots up. The /vendor/laravel/framework/src/Illuminate/Foundation/start.php bootstrap file calls registerAliasLoader() on an instance of Illuminate\Foundation\Application.