Skip to content

Instantly share code, notes, and snippets.

View junkblocker's full-sized avatar

Manpreet Singh junkblocker

View GitHub Profile
@junkblocker
junkblocker / hn-betteridge.user.js
Created February 21, 2017 15:13 — forked from noibl/hn-betteridge.user.js
Betteridge's Law for Hacker News
// ==UserScript==
// @name BetteridgeLinks
// @description Lowlight headlines on Hacker News that conform to Betteridge's Law
// @version 0.3
// @match http://news.ycombinator.com/*
// @match https://news.ycombinator.com/*
// @author noibl <pjpee6w5pc@snkmail.com>
// ==/UserScript==
var questions = ['Is', 'Are', 'Does', 'Do', 'Has', 'Have', 'Did', 'Will', 'Can', 'Could', 'Should'];
/* jshint maxerr : 10000 */
/* jslint browser : true */
/* jslint esversion : 6 */
try {
console.log('foo')
console.log('foo')
console.log('foo')
console.log('foo')
console.log('foo')
@junkblocker
junkblocker / song.rb
Created September 9, 2012 01:57 — forked from natew/song.rb
Rails model for parsing artist information from a song
class Song
# Regular expressions
RE = {
:featured => /(featuring | ?ft\.? |feat\.? |f\. |w\/){1}/i,
:remixer => / remix| rmx| edit| bootleg| mix| remake| re-work| rework| extended remix| bootleg remix/i,
:mashup_split => / \+ | x | vs\.? /i,
:producer => /^(produced by|prod\.? by |prod\. )/i,
:cover => / cover/i,
:split => /([^,&]+)(& ?([^,&]+)|, ?([^,&]+))*/i, # Splits "one, two & three"
:open => /[\(\[\{]/,
import objc
import AddressBook as ab
import pprint as pp
def pythonize(objc_obj):
if isinstance(objc_obj, objc.pyobjc_unicode):
return unicode(objc_obj)
elif isinstance(objc_obj, ab.NSDate):
return objc_obj.description()
@junkblocker
junkblocker / itunes_notifications.py
Last active August 29, 2015 14:25 — forked from codiez/itunes_notifications.py
Listen for distributed notifications from iTunes of the current song
'''
This python script listens for distributed notifications from iTunes of new songs playing,
works alot better then constantly polling.
'''
import Foundation
from AppKit import *
from PyObjCTools import AppHelper
class GetSongs(NSObject):
def getMySongs_(self, song):