Skip to content

Instantly share code, notes, and snippets.

View michahell's full-sized avatar

Michael Trouw michahell

View GitHub Profile
@michahell
michahell / tips_MySQL.md
Last active September 28, 2015 11:33
MySQL SHOW databases alias

If you ever need to execute the following SQL statement in MySQL:

SHOW databases; or especially SHOW databases LIKE 'somePrefix_%'; and you want to alias or name the returned dataset, you can't do that with the SHOW statements as they are very limited. You can however do this if you make use of the INFORMATION_SCHEMA default MySQL table:

SELECT SCHEMA_NAME AS `Database` FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 'somePrefix_%';

You're welcome!

@michahell
michahell / gist:7c7a809d9c63bd8fc81e
Last active September 16, 2015 11:38 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# First:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
#go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
@michahell
michahell / FRPandPhilosophy.md
Last active August 28, 2015 07:59 — forked from dmvaldman/FRPandPhilosophy.md
Descartes, Berkeley and Functional Reactive Programming

Descartes, Berkeley and Functional Reactive Programming

By @dmvaldman

Functional Reactive Programming (FRP) is generating buzz as an alternative to Object Oriented Programming (OOP) for certain use cases. However, an internet search quickly leads a curious and optimistic reader into the rabbit-hole of monads, functors, and other technical jargon. I’ve since emerged from this dark and lonely place with the realization that these words are mere implementation details, and that the core concepts are far more universal. In fact, the groundwork was laid down many centuries before the first computer, and has more to do with interpretations of reality, than structuring programs. Allow me to explain.

There’s an old thought experiment that goes like this:

Tree

Finding duplicate Pinboard bookmarks.

Run this Node script against your exported JSON file, which you'll need to enter in the FILEPATH variable.

The keyfor method returns the relevant part of the URL. You can customize it based on the available properties.

@michahell
michahell / google-maps-set-center-with-offset.js
Last active February 22, 2024 15:21 — forked from msherstobitow/google-maps-set-center-with-offset.js
google maps set and get center with offset
google.maps.Map.prototype.setCenterWithOffset= function(latlng, offsetX, offsetY) {
var map = this;
var ov = new google.maps.OverlayView();
ov.onAdd = function() {
var proj = this.getProjection();
var aPoint = proj.fromLatLngToContainerPixel(latlng);
aPoint.x = aPoint.x+offsetX;
aPoint.y = aPoint.y+offsetY;
map.setCenter(proj.fromContainerPixelToLatLng(aPoint));
};
@michahell
michahell / colors.py
Last active August 29, 2015 14:18 — forked from jossef/colors.py
RESET = '\033[0m'
BOLD = '\033[01m'
DISABLE = '\033[02m'
UNDERLINE = '\033[04m'
REVERSE = '\033[07m'
STRIKE_THROUGH = '\033[09m'
INVISIBLE = '\033[08m'
FG_BLACK = '\033[30m'
FG_RED = '\033[31m'
@michahell
michahell / .bowerrc
Last active August 29, 2015 14:16 — forked from facultymatt/.bowerrc
{
"directory": "components"
}
import os
import time
# Config
NAME = ["Steven Kafshaz"]
LASTMSG = {}
def filesbychannel(dirlist):
out = {}

Business Models

Advertising

Models Examples
Display ads Yahoo!
Search ads Google

##Angular directives for Flat UI

  • checkboxes
  • radio buttons
  • switches

Check the JSFiddle

###Example