Skip to content

Instantly share code, notes, and snippets.

@timelf123
timelf123 / addTrailingSlashApiInterceptor.service.js
Created August 3, 2016 22:23
addTrailingSlashApiInterceptor.service.js
app.factory('addTrailingSlashApiInterceptor', function ($q) {
return {
'request': function(config) {
if (config.url.indexOf('/api/') != -1 && config.url.slice(-1) != '/') {
config.url += '/';
}
return config || $q.when(config);
}
};
});
@timelf123
timelf123 / pr.md
Created July 29, 2016 13:39 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@timelf123
timelf123 / pauseChildrenWatchersIf.directive.js
Created March 29, 2016 14:21
Pauses all the children's $$watchers if the expression on the attribute evaluates to true, on false it restores any backed up $$watchers http://stackoverflow.com/a/29840248/411284
app.directive('pauseChildrenWatchersIf', function(){
return {
link: function (scope, element, attrs) {
scope.$watch(attrs.pauseChildrenWatchersIf, function (newVal) {
if (newVal === undefined) {
return;
}
if (newVal) {
toggleChildrenWatchers(element, true)
@timelf123
timelf123 / clickable-element.html
Created March 29, 2016 14:20 — forked from scottmagdalein/clickable-element.html
Make the Mailchimp Subscriber popup appear on click
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
@timelf123
timelf123 / duplicateRequestsFilter.js
Created March 15, 2016 22:43 — forked from adamreisnz/duplicateRequestsFilter.js
An AngularJS $http decorator to filter duplicate requests
/**
* Module definition and dependencies
*/
angular.module('Api.DuplicateRequestsFilter.Decorator', [])
/**
* Config
*/
.config(function($provide) {
@timelf123
timelf123 / rar2fsplex.sh
Created January 23, 2016 22:02
rar2fs - mount rars as files for streaming in plex etc
rar2fs on /stuff/media type fuse.rar2fs (rw,nosuid,nodev,allow_other,default_permissions)
git clone git://github.com/sivel/speedtest-cli.git speedtest-cli
@timelf123
timelf123 / gource.sh
Created January 15, 2016 05:52 — forked from XueshiQiao/gource.sh
Generate a MP4 Video for your Git project commits using Gource!
# 1.install gource using HomeBrew
$ brew install gource
# 2.install avconv
git clone git://git.libav.org/libav.git
cd libav
# it will take 3-5 minutes to complie, be patient.
./configure --disable-yasm
make && make install
@timelf123
timelf123 / linkedin-query.py
Created January 13, 2016 03:01 — forked from rvanbruggen/linkedin-query.py
Python script to query your LinkedIn network and get all your network's connections and their interconnections.
#!/usr/bin/env python
# encoding: utf-8
"""
linkedin-query.py
Created by Thomas Cabrol on 2012-12-03.
Customised by Rik Van Bruggen
Copyright (c) 2012 dataiku. All rights reserved.
Building the LinkedIn Graph
@timelf123
timelf123 / clone-personal-github.sh
Last active January 8, 2016 02:14
clone your personal github projects
curl -u [[USERNAME]] -s https://api.github.com/users/[[USERNAME]]/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'