Skip to content

Instantly share code, notes, and snippets.

View GabLeRoux's full-sized avatar
:shipit:
Shipping code for humans ✌

Gabriel Le Breton GabLeRoux

:shipit:
Shipping code for humans ✌
View GitHub Profile

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@bmwant
bmwant / stateMock.js
Last active June 8, 2017 13:29
Angular mock for the state
angular.module('stateMock', []);
angular.module('stateMock').service("$state", function($q) {
this.expectedTransitions = [];
this.transitionTo = function(stateName) {
if(this.expectedTransitions.length > 0) {
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName) {
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
} else {
@creaoy
creaoy / extract-testflight.js
Created November 30, 2015 21:11 — forked from larsparendt/extract-testflight.js
Extract TestFlight user email addresses from iTunes Connect
//Make sure you scroll down to get all data loaded
var text = '';
$('.col-email').each(function(index,el) {
if (index == 0) {
text = 'Email, First Name, Last Name\n';
}
else {
//Email
text = text + $.trim($(el).find("a").text()) + ',';
//First Name

emacs --daemon to run in the background. emacsclient.emacs24 <filename/dirname> to open in terminal

NOTE: "M-m and SPC can be used interchangeably".

  • Undo - C-/
  • Redo - C-?
  • Change case: 1. Camel Case : M-c 2. Upper Case : M-u
  1. Lower Case : M-l
// Description:
// Milton basic commands.
import Slack from 'node-slack';
let slack = new Slack('https://hooks.slack.com/services/something/reallysecure');
function johnnyBomb (msg) {
slack.send({
text: 'DESTROY! DESTROY!',
@bitmand
bitmand / gist:c6b7332214d858130c52
Last active December 20, 2017 13:51
Salt Stack state for creating a uniq 2048-bit diffie hellman group
# Create a unique 2048 Diffie Hellman group
# https://weakdh.org
/etc/ssl/dhparams.pem:
cmd.run:
- name: openssl dhparam -out /etc/ssl/dhparams.pem 2048
- unless: test -f /etc/ssl/dhparams.pem
@mattlong
mattlong / admin.py
Created September 17, 2014 18:26
Add a custom admin page for a model and link to it from the detail page
from functools import update_wrapper
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.core.exceptions import PermissionDenied
from django.shortcuts import render
from myapp.models import Widget
from myapp.forms import ManageWidgetForm
@wilsonwc
wilsonwc / stateMock.js
Created January 10, 2014 17:24
Angular Mock for properly resolving ui-router $state in Karma unit tests
angular.module('stateMock',[]);
angular.module('stateMock').service("$state", function($q){
this.expectedTransitions = [];
this.transitionTo = function(stateName){
if(this.expectedTransitions.length > 0){
var expectedState = this.expectedTransitions.shift();
if(expectedState !== stateName){
throw Error("Expected transition to state: " + expectedState + " but transitioned to " + stateName );
}
}else{
@grahams
grahams / feedly-fluid-unread.js
Last active December 20, 2015 09:30
Fluid userscript for Feedly to badge the dock icon with a better count (instead of maxing out at 100+)
(function() {
// Load the script
var script = document.createElement("SCRIPT");
script.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js';
script.type = 'text/javascript';
document.getElementsByTagName("head")[0].appendChild(script);
// Poll for jQuery to come into existance
var checkReady = function(callback) {
if (window.jQuery) {
@GabLeRoux
GabLeRoux / Install-php-mysql-apache-on-osx-with-brew.md
Last active September 6, 2021 15:35 — forked from niepi/osx_php_homebrew.setup.md
Detailed steps to install PHP, MySQL, Apache and some usefull extensions such as xDebug on a mac running Mac Os X. Also included: PostgreSQL.

Install PHP, MySQL, PostgreSQL, Apache and xDebug on a Mac

You should have some tools installed like Homebrew, a text editor such as Sublime Text and it's subl command line app inside a bin folder and some basic terminal knowledge.

This gist is a more detailed version of niepi's gist with things that worked for me. It may help someone :)

Install PHP

$ brew install php --with-apache --with-mysql --with-pgsql --with-intl