Skip to content

Instantly share code, notes, and snippets.

View acotilla91's full-sized avatar

Alejandro Cotilla acotilla91

View GitHub Profile
@funkatron
funkatron / http_digest_example.php
Created April 30, 2011 20:08
An example of how to manually construct an HTTP Digest authentication header.
<?php
$url = 'http://domain.foo';
$uri = '/assets';
$username = 'testyser';
$password = 'somepassword';
$method = 'GET';
$ht = new HttpRequest($url.$uri, HttpRequest::METH_GET);
$ht->send();
@gre
gre / easing.js
Last active April 13, 2025 15:13
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See the COPYING file for more details.
*/
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
@jpadilla
jpadilla / gist:2275208
Created April 1, 2012 13:08
Facebook locale codes
$list = array(
"ca_ES" => "Català",
"cs_CZ" => "Čeština",
"cy_GB" => "Cymraeg",
"da_DK" => "Dansk",
"de_DE" => "Deutsch",
"eu_ES" => "Euskara",
"en_PI" => "English (Pirate)",
"en_UD" => "English (Upside Down)",
"ck_US" => "Cherokee",
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@soutar
soutar / proxy.js
Last active November 14, 2022 20:14
Redirect HTTP traffic on Internet Sharing to a local Charles proxy
#!/usr/bin/env node
var options = require('minimist')(process.argv.slice(2), { default: {
cport: 8888
}});
var disable = options.disable || options.d;
var enable = options.enable || options.e;
var status = options.s || options.status;
var child = require('child_process');
import UIKit
import AVFoundation
public extension AVCaptureVideoOrientation {
public init(interfaceOrientation: UIInterfaceOrientation) {
switch interfaceOrientation {
case .Unknown:
self = .LandscapeLeft
case .Portrait:
@TomCan
TomCan / restart-samba.sh
Created July 23, 2015 14:53
Restart Mac OS X smb service from terminal/cli
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist EnabledServices -array disk

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8

@dneprDroid
dneprDroid / VideoPreviewView.swift
Last active July 13, 2023 14:43
VideoPreviewView - video capture and preview (swift 3)
// swift 3
import UIKit
import AVFoundation
class VideoPreviewView: UIView {
private var videoOutput: AVCaptureMovieFileOutput?
private var captureSession: AVCaptureSession?
private var previewLayer: AVCaptureVideoPreviewLayer?
@frankrausch
frankrausch / String+Hyphenation.swift
Last active June 15, 2023 16:45
Returns a String with soft hyphens (U+00AD)
import Foundation
extension String {
func hyphenated(languageCode: String) -> String {
let locale = Locale(identifier: languageCode)
return self.hyphenated(locale: locale)
}
func hyphenated(locale: Locale) -> String {