Skip to content

Instantly share code, notes, and snippets.

@ivanhoe011
ivanhoe011 / adfly.php
Last active March 17, 2016 12:04 — forked from mikeemoo/gist:714f39befbeb188dcec9
resolve adfly from command line
<?php
/**
* Usage: php adfly.php <adfly url>
*/
// original function by mikeemoo (mikeemoo/gist:714f39befbeb188dcec9)
function resolveAdfly($url) {
if (!preg_match("@https?:\/\/adf\.ly\/[a-z0-9]+@i", $url)) {
return $url;
}
@ivanhoe011
ivanhoe011 / mail.php
Created July 1, 2016 13:19 — forked from gjuric/mail.php
Script to open sent mail in Apple Mail
#!/usr/bin/env php
<?php
# Save this script somewhere and set you sendmail path in php.ini like this:
# sendmail_path = sudo -u <your_system_username> <path_to_script>/mail.php
# create a filename for the emlx file
list($ms, $time) = explode(' ', microtime());
$filename = dirname(__FILE__).'/'.date('Y-m-d h.i.s,', $time).substr($ms,2,3).'.emlx';
# write the email contents to the file
@ivanhoe011
ivanhoe011 / gist:3d8a6903506ca720a73da891afe50d0a
Last active August 7, 2016 16:15
Checking the size of babel
$ npm list babel-preset-es2015
[email protected] [...path removed as it's not important...]
$ cd node_modules/babel-preset-es2015/
$ find . -name 'node.js' | grep '/lib/api'
./node_modules/babel-plugin-transform-regenerator/node_modules/babel-core/lib/api/node.js
$ du -sh ./node_modules/babel-plugin-transform-regenerator/node_modules/babel-core/lib/api/node.js
4.0K ./node_modules/babel-plugin-transform-regenerator/node_modules/babel-core/lib/api/node.js
@ivanhoe011
ivanhoe011 / happy_git_on_osx.md
Created August 19, 2016 00:01 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "[email protected]"

/* WP WYSIWYG Editor Styles */
.entry-content img {
margin: 0 0 1.5em 0;
}
.alignleft, img.alignleft {
margin-right: 1.5em;
display: inline;
float: left;
@ivanhoe011
ivanhoe011 / sql-mixin.md
Created November 4, 2016 08:03 — forked from rgbkrk/sql-mixin.md
Turning lodash into declarative SQL

Lodash has a sweet feature called a mixin that lets you alias function names. Below here I alias names that we're used to using in SQL to (roughly) equivalent functions in lodash.

_.mixin({
  select: _.map,
  from: _.chain,
  where: _.filter,
  groupBy: _.sortByOrder,
})
@ivanhoe011
ivanhoe011 / SparkRoleMiddleware.md
Created November 14, 2016 03:58 — forked from dillinghamio/SparkRoleMiddleware.md
Team Role Middleware For Laravel Spark

Team Role Middleware For Laravel Spark

Makes it simple to use Spark's role feature on routes

Route::group(['middleware'=>'role:owner'], function(){
    // owners only
});

Route::group(['middleware'=>'role:member'], function(){
@ivanhoe011
ivanhoe011 / countries_en_srb.csv
Last active November 2, 2017 10:06
The list of countries with their names in English and Serbian
name_eng name_srb alpha-3 region sub-region
Afghanistan авганистан AFG Asia Southern Asia
Åland Islands оландска острва ALA Europe Northern Europe
Albania албанија ALB Europe Southern Europe
Algeria алжир DZA Africa Northern Africa
American Samoa америчка самоа ASM Oceania Polynesia
Andorra андора AND Europe Southern Europe
Angola ангола AGO Africa Middle Africa
Anguilla ангвила AIA Americas Caribbean
Antarctica антарктик ATA
Users and their passwords attempts
[0]
4
1
1 -
2 !
2 !@
1 &
1 0
3 0000
#!/bin/bash
URL="https://www.youtube.com/watch?v=MnIYp-PaoXg&list=PLRtkK6TD_2LLWHeAAYnalSVCXZV0T39vu&index=1"
~/bin/youtube-dl -x -k -o "%(playlist_index)02d. %(title)s - %(id)s.%(ext)s" --audio-format "mp3" --audio-quality 0 "$URL"
for F in *.mp3; do
ARTIST="Daniel Delux"
NUM=$(echo "${F}" | sed -e 's/^\([0-9]\+\)\..*$/\1/')
TITLE=$(echo "${F}" | sed -e 's/^[0-9]\+\.\s*//' -e 's/^\(.\+\) - \(.\+\) - .*$/\2/')