Skip to content

Instantly share code, notes, and snippets.

View lajlev's full-sized avatar

Michael Lajlev lajlev

View GitHub Profile
<?php
// The JSON feed is gzipped. This is needed to unpack it before using
require('inc/gzdecode.php');
// Get the JSON feed and gzunpack
$file = gzdecode( file_get_contents("http://s.trustpilot.com/tpelements/917278/f.json.gz") );
// JSON decode the string
$json = json_decode($file);
?>
<header>
<h1><?php echo $json->TrustScore->Human; ?></h1>
<img src="<?php echo $json->TrustScore->StarsImageUrls->large; ?>" alt="stars"/>
<p class="review-count"><?php echo $json->ReviewCount->Total; ?> customers has written a review on Trustpilot</p>
</header>
@lajlev
lajlev / mediaqueries.scss
Created April 11, 2012 16:12
Sass - Media queries made simple
//
// sass - Media queries made simple
//
// @require sass-3.2 (you need eventually to do "sudo gem install sass --pre")
//
// Inspired by Maxime Thirouin & Mason Wendell
/* How to use it?
.class-name {
@include mq(phone) { color:pink }
@lajlev
lajlev / dabblet.css
Created April 18, 2012 08:18 — forked from LeaVerou/dabblet.css
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
@lajlev
lajlev / fogbugz.css
Created April 22, 2012 14:25
Stylebot: Convert Fogbugz UI into zen-mode
*/////////
A overriding stylesheet for Fogbugz.com UI (Chrome only)
Indention and order is this gist is totally fucked, but the result is soooo calm.
Require: Chrome stylbot extension http://bit.ly/JZaFzB
*/////////
#containerLogo {
display: none;
}
@lajlev
lajlev / responsive-2col-simple.html
Created May 25, 2012 10:32
simple 2 column responsive website
<!DOCTYPE HTML>
<!-- Based on http://webdesignerwall.com/tutorials/responsive-design-in-3-steps -->
<html lang="en-US">
<head>
<meta charset="UTF-8">
<!-- Most mobile browsers scale HTML pages to a wide viewport width so it fits on the screen. You can use the viewport meta tag to reset this. The viewport tag below tells the browser to use the device width as the viewport width and disable the initial scale. -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Responsive-2col-simple</title>
@lajlev
lajlev / mysql_commands.sql
Created September 20, 2012 11:04
Create user and grant access to mysql database
/* Login from terminal */
mysql -u USERNAME -p DATABASENAME;
/* Simple commands */
create database DATABASENAME;
show databases;
use DATABASENAME;
/* Create a user and grant access to database */
grant all privileges on DATABASENAME.*
@lajlev
lajlev / bashgitcompletion.md
Created November 14, 2012 00:07
Install Bash git completion

Install Bash git completion

git-flow completion requires git-completion to work. How exactly you go about installing git-completion varies wildly from system to system, so it's hard to give exact installation instructions.

Install homebrew

Install Git and bash-completion: brew install git bash-completion (Note: If this install fails with a 404 error, and you already have git installed, just remove the git part of this brew install) Add bash-completion to your .bash_profile:

if [ -f `brew --prefix`/etc/bash_completion ]; then
    . `brew --prefix`/etc/bash_completion

fi

@lajlev
lajlev / .bash_profile
Created November 15, 2012 10:00
My .bash_profile pimped with coloring, intelligent path, alias for git etc
PATH="/usr:bin:/usr/local/bin:/usr/local/sbin:$PATH" # if not already present
export PATH=/usr/local/bin/psql:$PATH
PROMPT_COMMAND='DIR=`pwd|sed -e "s!$HOME!~!"`; if [ ${#DIR} -gt 20 ]; then CurDir=${DIR:0:5}...${DIR:${#DIR}-15}; else CurDir=$DIR; fi'
#PS1="[\$CurDir] \$ "
function color_my_prompt {
local __user_and_host="\[\033[01;32m\]\u@\h"
local __cur_location="\[\033[01;34m\]\w"
@lajlev
lajlev / index.slim
Created December 10, 2012 11:26
A CodePen by Michael Lajlev.
h1 This is why I want flex box so badly
p Makes it possible to have a element take out the remaining space, without having a fixed width on the first element (in this case the button).
br
br
#flexbox
div
input type="button" value="Search"
div