Skip to content

Instantly share code, notes, and snippets.

View algonrey's full-sized avatar
😎
(☞゚ヮ゚)☞

Alberto González algonrey

😎
(☞゚ヮ゚)☞
View GitHub Profile
@henrik242
henrik242 / Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts.md
Last active March 28, 2024 17:25
Global macOS hotkeys for Google Meet, Spotify and others using AppleScript and Fastscripts
@eralston
eralston / NSArray+WeakArray.h
Last active July 5, 2023 09:11
An pair of Objective-C categories on NSArray and NSMutableArray that provides a mechanism for weak referencing any type of Objective-C object. This was created when I found a case, referencing protocols, where NSPointerArray did not work for my needs.
//
// NSMutableArray+WeakArray.h
//
#import <Foundation/Foundation.h>
///
/// Category on NSArray that provides read methods for weak pointers
/// NOTE: These methods may scan the whole array
///
@flesch
flesch / basic-auth.js
Last active July 27, 2022 12:39
HTTP Basic Authentication with Express, without express.basicAuth.
var express = require("express");
var app = express();
app.get("/restricted", function(req, res, next){
// Grab the "Authorization" header.
var auth = req.get("authorization");
// On the first request, the "Authorization" header won't exist, so we'll set a Response
// header that prompts the browser to ask for a username and password.
- (IBAction)downloadFile:(id)sender {
NSURL *url = [NSURL URLWithString:@"http://www.hulkshare.com/dl/qw30o7x373a8/stan_courtois_&_felly_vs_cutting_crew_-_die_in_your_arms_(x-centrik_mix)_%5B_www.themusix.net_%5D.mp3"];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
NSString *fullPath = [NSTemporaryDirectory() stringByAppendingPathComponent:[url lastPathComponent]];
[operation setOutputStream:[NSOutputStream outputStreamToFileAtPath:fullPath append:NO]];