Skip to content

Instantly share code, notes, and snippets.

@hectorddmx
hectorddmx / fix_cocoapods_catalina.sh
Last active October 25, 2023 16:39
Remove homebrew cocoapods installation in catalina, and install directly from gem, zsh version
#! /bin/zsh
install_cocoapods () {
echo "Installing cocoapods with gem"
# Creating new gems home if it doesnt't exist
if [ ! -d "$HOME/.gem" ]; then
mkdir "$HOME/.gem"
fi
# Adding to current session
@Qwerios
Qwerios / gist:11371459
Last active January 22, 2018 17:01
Setting up private NPM repository

Official npm mirror

The main idea is to make an official NPM mirror as detailed here: https://github.com/npm/npm-registry-couchapp

Unfortunately the above instructions appear to be flawed and didn't working for me. Thankfully someone has taken the time to create an updated set of installation instructions: https://github.com/rvagg/npmjs.org/tree/new-install-docs

Bug with updated instructions

Only one problem remains with the above instructions and that is the credentials for the copy script. In copy.sh you need to fix the credentials for curl. Change this (line 46):

@hiddentao
hiddentao / gist:7300694
Last active January 22, 2019 05:04
An improvement on the angular.module() API, making it easier to split up modules into multiple files without having to worry about only registering them once.
/**
* Workaround to make defining and retrieving angular modules easier and more intuitive.
*/
(function(angular) {
var origMethod = angular.module;
var alreadyRegistered = {};
/**
@eyston
eyston / controller.js
Created June 24, 2013 17:11
angular typeahead
angular.module('ymusica').controller('AlbumSearch', ['$scope', 'Albums', 'Artists', '$q', function($scope, albums, artists, $q) {
$scope.albums = [];
$scope.artists = [];
var terms = new Rx.Subject();
$scope.searchMusic = terms.onNext.bind(terms);
terms.sample(250)
@mmazer
mmazer / parseheaders.js
Created April 17, 2013 13:30
JavaScript - parse XmlHttpRequest.getAllResponseHeaders into a key value pair.
/**
* XmlHttpRequest's getAllResponseHeaders() method returns a string of response
* headers according to the format described here:
* http://www.w3.org/TR/XMLHttpRequest/#the-getallresponseheaders-method
* This method parses that string into a user-friendly key/value pair object.
*/
function parseResponseHeaders(headerStr) {
var headers = {};
if (!headerStr) {
return headers;
@purdrew
purdrew / file_cr_rm.html
Created January 10, 2012 20:15
Example of using the File API to create/remove a file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" id="viewport" content="width=device-width,height=device-height,initial-scale=1.0,user-scalable=no">
<script src="json2.js" type="text/javascript"></script>
<script src="phonegap.js" type="text/javascript"></script>
<script type="text/javascript">
// invoked when device is ready