Skip to content

Instantly share code, notes, and snippets.

View lajlev's full-sized avatar

Michael Lajlev lajlev

View GitHub Profile
@lajlev
lajlev / Gruntfile.js
Last active August 29, 2015 14:10
Script to optimize & combine SVG files
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt)
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
svgmin: {
dist: {
expand: 'true',

Keybase proof

I hereby claim:

  • I am lajlev on github.
  • I am lajlev (https://keybase.io/lajlev) on keybase.
  • I have a public key whose fingerprint is 0CCE 9020 6843 944A 325C FBBE F930 C27C 3BAF 7BBE

To claim this, I am signing this object:

@lajlev
lajlev / ebert.rb
Created December 16, 2014 09:09
How do I capitalize the words?
#!/usr/bin/ruby
tmp = "{query}"
# If there was a query, then parse the query
unless tmp.nil? || tmp == 0
args = tmp.split
num = args.at(0)
char_limit = args.at(1)
else
@lajlev
lajlev / .bash_function
Created May 14, 2015 13:52
WP-CLI create bash function
wp-create() {
wp core download
git init
gi wordpress >> .gitignore
mysql -uroot -proot -e "create database $1;"
wp core config --dbname=$1 --dbuser=root --dbpass=root
wp core install --url=http://$1.wp --title=$1 --admin_user=lajlev --admin_password=7913 [email protected]
}
@lajlev
lajlev / foo.bash
Last active August 29, 2015 14:28
Bulk convert images to grayscale
for i in *.jpg; do convert $i -colorspace Gray gray/$i; done
@lajlev
lajlev / slack_slash-command_frokost-dk.php
Created May 25, 2016 12:07
A Slack - slash command for frokost.dk
<?php
// Create a new slack slash command https://my.slack.com/services/new/slash-commands
header('Content-Type: application/json; charset=utf-8');
# Grab token from the slash command.
$token = $_POST['token'];
# Check the token and make sure the request is from our team
#!/bin/sh
# Requires sketch and Sketchtool
# Q: How to enable it?
# A: Add it to your repo pre-commit hook
# Q: What does it do?
# A: It creates a .exportArtboards folder with all artboards as PNGs,
# so you easily can see changes in GIT 🎊.
@lajlev
lajlev / bitbucket.sh
Last active February 14, 2017 08:15
Bitbucket bash commands
function bbcreate(){
curl -s -S -X POST -v -u lajlev:$BITBUCKET_PASS -H "Content-Type: application/json" \
https://api.bitbucket.org/2.0/repositories/lajlev/$1 \
-d '{"scm": "git", "is_private": "true", "fork_policy": "no_public_forks" }' > /dev/null
printf "\n 🍄 https://bitbucket.org/lajlev/$1 created\n\n"
}
function bbdelete(){
read -r -p "Delete https://bitbucket.org/lajlev/$1 ? [y/N] " response
response=${response,,}
@lajlev
lajlev / create-remove-view-repo.sh
Last active August 24, 2018 10:39
View, create & delete bitbucket repo via Bash function
# Create a Bitbucket repo
function bbcreate () {
if [ $# == 1 ]; then # Passing an parameter?
curl -s -S -X POST --user $BITBUCKET_USER:$BITBUCKET_PASS "https://api.bitbucket.org/2.0/repositories/lajlev/$1" -d "is_private=true" # Create a private repo
git init # Init local git repo
git remote add origin [email protected]:$BITBUCKET_USER/$1.git # Add Bitbucket repo as git remote
printf "\n\n\n 🍄 https://bitbucket.org/$BITBUCKET_USER/$1 created\n\n" # Confirm messsage
else # No parameter
printf "\n Please enter a repo name 👍\n\n"
fi
@lajlev
lajlev / iconMonster.js
Created November 30, 2018 09:28 — forked from illmat/iconMonster.js
Doesn't actually download anything, but saves all svgs from Iconmonstr by grabbing each inline svg from the preview box. If you like the Icons please consider to make a donation for the iconmostr wesbite - http://iconmonstr.com/
var casper = require('casper').create();
var fs = require('fs');
var pages = [];
casper.start('http://iconmonstr.com/page/2', function () {
var pageNumbers = this.evaluate(function () {
return $('a.page-numbers:nth-child(7)').html();
});