Skip to content

Instantly share code, notes, and snippets.

View tilap's full-sized avatar
🏠
Working from home

Tilap tilap

🏠
Working from home
View GitHub Profile
@tilap
tilap / functions.php
Last active July 23, 2023 09:29
Wordpress: How to automatically attache youtube/vimeo thumbnail as a post feature image from a post meta key
function insertThumbnail($data, $postArr) {
if(!isset($postArr['ID'])) {
return $data;
}
$postId = $postArr['ID'];
$metaKey = 'you-post-meta-video-key'; // the custom meta key
// If video and video format
if(isset($postArr[$metaKey]) && ''!==$postArr[$metaKey] ) {
@tilap
tilap / urlToFile.js
Created July 5, 2014 11:06
nodejs: copy remote web file on local
/*
* copy remote web file on local
*
* usage:
* require('urlToFile')('http://domain.tld/image.jpg', '/local/path/image.jpg', function() {console.log('success !');}, function(message) {console.log(message);});
*/
var http = require('http');
var fs = require('fs');
@tilap
tilap / web-frontend-ressources-all.md
Last active August 29, 2015 14:05
Web Frontend Ressources
@tilap
tilap / gulp-usefull-plugins.md
Created September 11, 2014 07:14
Gulp usefull plugins
@tilap
tilap / hasNestedProperties.js
Last active August 29, 2015 14:06 — forked from cyrilf/hasNestedProperties.js
JS function to check if an object has the nested properties
/**
* hasNestedProperties check if an object has the nested
* properties passed in params
*
* @param {Object} obj object we want to test
* @param {String} properties nested property we want
* @return {Boolean} either the object has these
* nested properties or not
*/
@tilap
tilap / git.bash
Last active August 29, 2015 14:06
gith: a bashrc alias to get quick repo statement overview
alias gith='echo "=== Remote ===" && git remote -v && echo "" && echo "=== Branch ===" && git branch -v && echo "" && echo "=== Latest commits ===" && git log --pretty="%cr (%cn) %s" -n 15 --date=relative'
@tilap
tilap / download_gists.js
Last active August 29, 2015 14:08 — forked from thomastraum/download_gists.js
Download all public gist with nodejs
var request = require('request')
, path = require('path')
, fs = require('fs')
, url = "https://api.github.com/users/thomastraum/gists"
, savepath = './gists';
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
@tilap
tilap / .bash_alias
Created October 27, 2014 08:14
Alias bash git overview
alias gith='echo "=== Remote ===" && git remote -v && echo "" && echo "=== Branch ===" && git branch -v && echo "" && echo "=== Latest commits ===" && git log --pretty="%cr (%cn) %s" -n 15 --date=relative'
@tilap
tilap / mixin.less
Created November 6, 2014 16:41
Retina image url mixin for Less
@highdpi: ~"(-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (-o-min-device-pixel-ratio: 3/2), (min-resolution: 1.5dppx)";
.retina-bg(@path) {
background-image: url(@path);
@at2x_path: ~`@{path}.replace(/\.\w+$/, function(match) { return "@2x" + match; })`;
@media @highdpi {
background-image: url("@{at2x_path}");
}
}
@tilap
tilap / head.html
Last active August 29, 2015 14:10
Fastclick
<script type='application/javascript' src='/path/to/fastclick.js'></script>
<script type='application/javascript'>
window.addEventListener('load', function() {
new FastClick(document.body);
}, false);
</script>