Skip to content

Instantly share code, notes, and snippets.

View lajlev's full-sized avatar

Michael Lajlev lajlev

View GitHub Profile
@lajlev
lajlev / gist:6267234
Last active December 21, 2015 06:49
mark autocomplete error
### "mark" functionality http://jeroenjanssens.com/2013/08/16/quickly-navigate-your-filesystem-from-the-command-line.html
export MARKPATH=$HOME/.marks
function jump {
cd -P "$MARKPATH/$1" 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p "$MARKPATH"; ln -s "$(pwd)" "$MARKPATH/$1"
}
function unmark {
rm -i "$MARKPATH/$1"
@lajlev
lajlev / bookmarklet-gmail-compose.md
Last active December 21, 2015 04:18
How to create a bookmarklet to compose funktion in gmail.
  • Create a bookmark to Gmail.
  • Edit & paste following snippet into the url field.
javascript:var w=window,u='https://mail.google.com/mail/u/0/?ui=2&view=cm&fs=1&tf=1',l=document.location;try{ throw(0); } catch(z) {a =function(){if(!w.open(u,'t','toolbar=0,resizable=0,status=1,width=600,height=500'))l.href=u;};if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a();}void(0)
  • Boom you got a bookmarklet which make you able to compose an email, without having to enter you bloated inbox :)
@lajlev
lajlev / drupal-array-dump.php
Created August 2, 2013 11:28
Drupal var dump (Lookup array in drupal)
<?php // drupal_set_message('<pre>' . check_plain(var_export($node_name, TRUE)) . '</pre>'); ?>
@media screen and (min-width: 32em) {
.content .schedule-component {
float: left;
width: 100%;
position: relative;
}
.content .schedule-component ul,
.content .schedule-component li {
list-style: none;
position: absolute;
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page</title>
<style>
body {
background: pink;
}
iframe {
@lajlev
lajlev / .htaccess
Created May 1, 2013 12:56
Fetch wordpress uploads from production.
# Attempt to load files from production if they're not in our local version. Put this file in "wp-content/uploads" folder.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://cfdp.dk/wordpress/wp-content/uploads/$1
</IfModule>
@lajlev
lajlev / wp-ftp-access-req.txt
Created May 1, 2013 08:06
Avoid req FTP access wordpress locally
1. Create php file in root folder. fx _www
<?php echo(exec("whoami")); ?>
2. Run in terminal
chown -R [whoami output]: [root folder]
# Do the following command
# Ref: http://soderlind.no/archives/2011/08/26/running-wordpress-locally-on-mac-os-x-lion/
# Chown / Chmod wordpress folder
$ sudo chown -R :_www wordpress
$ sudo chmod -R g+w wordpress
# Add to "wp-config.php"
define('FS_METHOD', 'direct');
@lajlev
lajlev / multiple-rename-files-terminal
Created April 12, 2013 00:22
Multiple rename files in terminal
num=0
for j in *.*
do
mv "$j" `printf "fb.%01d.jpg" $num`
num=`echo "$num + 1" | bc`
done
#set zeros on %01d
#You can set filename instead of *.*
@lajlev
lajlev / holder_js_helper.rb
Last active December 14, 2015 20:08
Holder.js helper for middleman. Holder.js works offline.
# Require holder.js https://github.com/imsky/holder
def holder(width, height)
color = ("%06x" % rand(0..0xffffff))
return '<img data-src="holder.js/' + width.to_s + 'x' + height.to_s + '/auto/#' + color.to_s + ':#' + color.to_s + '">'
end