Skip to content

Instantly share code, notes, and snippets.

View reatlat's full-sized avatar
🖖
Live long and prosper!

Alex Zappa reatlat

🖖
Live long and prosper!
View GitHub Profile
/**
* version1: convert online image
* @param {String} url
* @param {Function} callback
* @param {String} [outputFormat='image/png']
* @author HaNdTriX
* @example
convertImgToBase64('http://goo.gl/AOxHAL', function(base64Img){
console.log('IMAGE:',base64Img);
})
@reatlat
reatlat / mixins.jade
Created March 11, 2016 09:59 — forked from shaneriley/mixins.jade
Jade mixins example
// Writing JS for everything is great and all, but I don't want to see JS
// inline in my Jade templates. Thankfully, there are ways of abstrating it
// into mixins!
// Want some Rails-like helpers?
mixin link_to(name, href)
- href = href || "#"
a(href="#{href}")= name
// How about a single editing point for a class name?
@reatlat
reatlat / gist:09acf7afed7d254ec5c0
Created March 25, 2016 08:29 — forked from skypce/gist:355e56d0774160bb5619
Upwork Client fix for Ubuntu 14.04 ( Unknown SSL error -12218 mapped to net::ERR_SSL_PROTOCOL_ERROR)
If you have this error: Unknown SSL error -12218 mapped to net::ERR_SSL_PROTOCOL_ERROR
and your upwork client does not run you need:
sudo apt-get install libnss3=2:3.15.4-1ubuntu7 libnss3-nssdb=2:3.15.4-1ubuntu7
sudo apt-mark hold libnss3 libnss3-nssdb
Solution provided by Ilya E from upwork.
!function(a,b){a.MixItUp.prototype.addAction("_constructor","pagination",function(){var b=this;b.pagination={limit:0,loop:!1,generatePagers:!0,maxPagers:5,pagerClass:"",prevButtonHTML:"&laquo;",nextButtonHTML:"&raquo;"},a.extend(b.selectors,{pagersWrapper:".pager-list",pager:".pager"}),a.extend(b.load,{page:1}),b._activePage=null,b._totalPages=null,b._$pagersWrapper=a()},1),a.MixItUp.prototype.addAction("_init","pagination",function(){var a=this;a._activePage=1*a.load.page,a.pagination.maxPagers="number"==typeof a.pagination.maxPagers&&a.pagination.maxPagers<5?5:a.pagination.maxPagers},1),a.MixItUp.prototype.addAction("_bindHandlers","pagination",function(){var b=this;b.pagination.generatePagers&&(b._$pagersWrapper=a(b.selectors.pagersWrapper)),b.controls.live?b._$body.on("click.mixItUp."+b._id,b.selectors.pager,function(){b._processClick(a(this),"page")}):b._$pagersWrapper.on("click.mixItUp."+b._id,b.selectors.pager,function(){b._processClick(a(this),"page")})},1),a.MixItUp.prototype.addAction("_processClick
/* Adjusted to give override background and text colour */
.highlight pre, pre, .highlight .hll {
background-color: #49483E;
border: 1px solid #ccc;
padding: 6px 10px;
border-radius: 3px;
color: #FFFFFF;
}
/* Highlights taken from https://gist.github.com/asaaki/1007420 for Monokai theme */
.c { color: #75715e } /* Comment */
<?php
/* ======================================================
This script is NOT FULLY TESTED (not tested on Windows Server either)
USE AT YOUR OWN RISK - development environment Ubuntu Linux 14.04.3 LTS
The purpose of this script is for small websites and blogs
to have their existing media to work through Amazon S3
There's a great plugin, WP Offload S3, that we'll be tapping
into...it works great for new media, but this is a quick
######################
# - Conky settings - #
######################
update_interval 1
total_run_times 0
net_avg_samples 1
cpu_avg_samples 1
imlib_cache_size 0
double_buffer yes
#!/bin/bash
# Digital Ocean
# Ubuntu 12.04 x64 Server
# Open VPN
echo "Select on option:"
echo "1) Set up new PoPToP server AND create one user"
echo "2) Create additional users"
read x
if test $x -eq 1; then
echo "Enter username that you want to create (eg. client1 or john):"
@reatlat
reatlat / functions.php
Created March 23, 2017 20:37
Get number of active WordPress widgets in a widget area
<?php
/**
* Count number of widgets in a sidebar
* Used to add classes to widget areas so widgets can be displayed one, two, three or four per row
*/
function slbd_count_widgets( $sidebar_id ) {
// If loading from front page, consult $_wp_sidebars_widgets rather than options
// to see if wp_convert_widget_settings() has made manipulations in memory.
global $_wp_sidebars_widgets;
@reatlat
reatlat / meta.hbs
Created June 8, 2017 18:28 — forked from ofstudio/meta.hbs
Meta tags snippet for Ghost Themes
{{!-- Tested on Ghost 0.5.7. --}}
{{!-- IMPORTANT! Some things are more likely to work in a different way in future versions of Ghost. Check the documentation --}}
{{#is "index, tag, author"}} {{!-- Meta for index, tag and author contexts --}}
{{#is "index"}}
<title>{{@blog.title}}</title>
<meta name="description" content="{{@blog.description}}"/>
<meta property="og:title" content="{{@blog.title}}"/>
<meta itemprop="name" content="{{@blog.title}}"/>
{{/is}}
{{#is "tag"}}