Skip to content

Instantly share code, notes, and snippets.

View albingeorge's full-sized avatar
🏠
Working from home

Albin George albingeorge

🏠
Working from home
  • IKEA
  • Amsterdam, Netherlands
View GitHub Profile
@albingeorge
albingeorge / gist:7243289
Created October 31, 2013 01:53
JavaScript function to set css property to an element #cross-browser
<script type="text/javascript">
function getTransformProperty(element) {
// Note that in some versions of IE9 it is critical that
// msTransform appear in this list before MozTransform
var properties = [
'transform',
'WebkitTransform',
'msTransform',
'MozTransform',
'OTransform'
@albingeorge
albingeorge / magento_custom_page
Created May 13, 2014 06:44
Create a custom page for magento
1. Declare a module:
app/etc/local.xml:
<!-- add this: -->
<modules>
<Mage_Sampleorder>
<codePool>local</codePool>
<active>true</active>
</Mage_Sampleorder>
</modules>
<!-- before: -->
@albingeorge
albingeorge / st3_preferences
Created June 10, 2014 07:40
Sublime Text 3 - User Preferences
{
"color_scheme": "Packages/User/Mac Classic (SL).tmTheme",
"font_face": "consolas",
"font_size": 14,
"ignored_packages":
[
"Vintage",
"SublimeLinter-phplint"
],
"show_full_path": true,
@albingeorge
albingeorge / 0_reuse_code.js
Created June 12, 2014 03:30
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@albingeorge
albingeorge / WP_Plugin.php
Created June 12, 2014 05:07
Wordpress Plugin initialisation
<?php
/**
* @package Hello_Dolly
* @version 1.6
*/
/*
Plugin Name: Hello Dolly
Plugin URI: http://wordpress.org/plugins/hello-dolly/
Description: This is not just a plugin, it symbolizes the hope and enthusiasm of an entire generation summed up in two words sung most famously by Louis Armstrong: Hello, Dolly. When activated you will randomly see a lyric from <cite>Hello, Dolly</cite> in the upper right of your admin screen on every page.
Author: Matt Mullenweg
@albingeorge
albingeorge / youtube_channel_download.py
Created July 24, 2014 07:12
Download all videos from a youtube channel
import mechanize
import cookielib
from bs4 import BeautifulSoup
import re, urllib2, sys, json, os, resource
from pprint import pprint
from urlparse import urlparse, parse_qs
class Browser:
"""A browser to use to crawl the site"""
@albingeorge
albingeorge / flipkart_deal_of_the_day.py
Created September 4, 2014 04:05
Flipkart - Deal of the day
from bs4 import BeautifulSoup
import urllib
def send_email(to, subject, message):
import smtplib
gmail_user = "<user-id>@gmail.com"
gmail_pwd = "<password>"
FROM = 'albinin000@gmail.com'
TO = to
@albingeorge
albingeorge / PHPCS pre-commit hook
Last active August 29, 2015 14:09
phpcs-pre-commit-hook
#!/bin/bash
# PHP CodeSniffer pre-commit hook for git
#
# @author Soenke Ruempler <soenke@ruempler.eu>
# @author Sebastian Kaspari <s.kaspari@googlemail.com>
#
# see the README
PHPCS_BIN=/usr/local/bin/phpcs
PHPCS_CODING_STANDARD=Zend
PHPCS_IGNORE=""
// Using native JavaScript...
function getMatches(str, regex) {
var matches = [];
var match;
if (regex.global) {
regex.lastIndex = 0;
} else {
regex = new RegExp(regex.source, 'g' +
@albingeorge
albingeorge / keybase.md
Created February 25, 2015 20:25
keybase.md

Keybase proof

I hereby claim:

  • I am albingeorge on github.
  • I am albin (https://keybase.io/albin) on keybase.
  • I have a public key whose fingerprint is FC08 AEB2 BB99 EADF 42EE C110 A710 C714 E5A5 02E9

To claim this, I am signing this object: