Skip to content

Instantly share code, notes, and snippets.

View johanbrook's full-sized avatar
🌴

Johan Brook johanbrook

🌴
View GitHub Profile
<?php
class User{
public $user_email = "[email protected]";
}
$obj = new User();
function return_stuff($key){
return $obj->$key;
@mixin icon($symbol, $color: transparent, $pos: left top){
background: $color url(style/images/#{$symbol}.png) no-repeat $pos;
padding-left: 25px;
}
// Usage:
@johanbrook
johanbrook / systmt.bookmarklet.js
Created April 1, 2011 11:11
Första versionen.
javascript:(function(){var c=window.location.search.substring(1);if(window.location.href.search('systembolaget.se')==-1||c.search('varuNr')==-1){alert('Hittade ingen URL från Systembolaget.se. Se till att du verkligen har en produktsida från Systembolaget.se öppen!');return false}else{var d='http://systmt.se/'+f('varuNr',c);alert('Din korta URL: '+d);return d}function f(g,h){var e=h.split('&'),a;for(var b=0;b<e.length;b++){a=e[b].split('=');if(a[0]==g){return a[1]}}}})();
var d = window.document,
s = d.createElement('script'),
u = 'https://gist.github.com/raw/898192/828a9f94ac02c4f95ed0e9538a9a7d26ad661395/systmt.js';
function load(){
if(d.readyState && d.readyState != 'complete'){
setTimeout(load, 200);
}else{
if(typeof systmt == 'undefined'){
@johanbrook
johanbrook / Rakefile
Created April 11, 2011 23:38
Rake tasks for deploying my personal site
require "rake"
desc "Build and upload site"
task :deploy => [:sass, :compile_all_js, :upload] do
end
desc "Make sure the master Sass file is compiled"
task :sass do
// As usual
$(document).ready(init);
// When the Ajax-event is complete, i.e. when the content is pulled in:
$(document).bind("pjax-complete", init);
function init(){
// Using Pjax (https://github.com/defunkt/jquery-pjax)
// Essentially just a wrapper around the .ajax() function which
@johanbrook
johanbrook / gist:1043617
Created June 23, 2011 21:00
Resets some fancy CSS2.1/CSS3 properties to (to some extent) simulate how an IE user sees the interface.
-moz-border-radius: 0 !important;
-webkit-border-radius: 0 !important;
border-radius: 0 !important;
text-shadow: none !important;
-webkit-box-shadow: none !important;
-moz-box-shadow: none !important;
box-shadow: none !important;
@johanbrook
johanbrook / gist:1043851
Created June 23, 2011 23:07
Quick jQuery dropdown plugin. Bind to link trigger. View available options below.
(function($){
/**
* Simple dropdown plugin
* By Johan
*/
$.fn.toggleDropdown = function(options){
var settings = {
activeClass: "dropdown-active",
menuSelector: ".dropdown-menu",
closeSelector: ".close"
@johanbrook
johanbrook / gist:1063968
Created July 4, 2011 21:28
Some custom user styles I created to clean up the latest Gmail theme from Google. Removes some annoying whitespace, adds hover effect on the inbox, removes ads.
// List
tr.zA > td{
padding-top: 5px !important;
padding-bottom: 5px !important;
}
// Mails
tr.zA:hover{
background-color: #FFFBC4 !important;
}
.clearfix:after{
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
.clearfix {display: inline-block;}