Skip to content

Instantly share code, notes, and snippets.

View bonatoc's full-sized avatar

Christian Bonato bonatoc

View GitHub Profile
@panurge-ws
panurge-ws / gist:525caef640784a487aa2
Last active May 20, 2016 10:38
A Videgular plugin to emulate background-size CSS property for video (see comment below).
/*
* vg-bkg-size
* A Videogular plugin to emulate background-size CSS property for video: "cover" or "contain"
*
* Use:
* <videogular vg-bkg-size="cover" center="true"></videogular>
* vg-bkg-size => "cover" or "contain"
* center => true or false
*
* Copyright (c) 2014 Panurge Web Studio
@billerickson
billerickson / gist:1448465
Created December 8, 2011 20:41
Install WordPress via SSH
For more details, see http://code.garyjones.co.uk/install-wordpress-ssh/
wget http://wordpress.org/latest.tar.gz
tar zxf latest.tar.gz
cd wordpress
cp -rpf * ../
cd ../
rm -rf wordpress/
rm -f latest.tar.gz
@Zren
Zren / gist:beaafd64f395e23f4604
Last active April 29, 2017 18:26
Ionic Scroll onMouseWheel
app.directive 'mouseWheelScroll', ($timeout) ->
return {
restrict: 'A'
# require: '^$ionicScroll'
link: ($scope, $element, $attrs) ->
scrollCtrl = $element.controller('$ionicScroll')
console.log scrollCtrl
unless scrollCtrl
return console.error('mouseWheelScroll must be attached to a $ionicScroll controller.')
@michalkvasnicak
michalkvasnicak / angular-better-image-lazy-load.js
Last active December 2, 2019 23:19
Better image lazy loading in AngularJS
angular.module('Demo', []).service(
'scrollAndResizeListener', function($window, $document, $timeout) {
var id = 0,
listeners = {},
scrollTimeoutId,
resizeTimeoutId;
function invokeListeners() {
var clientHeight = $document[0].documentElement.clientHeight,
clientWidth = $document[0].documentElement.clientWidth;
@davisford
davisford / .bowerrc
Last active November 11, 2020 07:09
Updated build system for Ionic Framework
{
"directory": "bower_components"
}
@murgatroydj
murgatroydj / external-link-new-tab.js
Last active March 19, 2021 16:11
Jquery snippet to add target="_blank" to all external links in a documen and force PDFs to open in a new window/tab as well.Replace mydomainname with yours to skip internal links.
@cemerson
cemerson / test.js
Created October 5, 2012 14:10
JavaScript: Detect iPhone4 / iPhone 5
var iphone4 = (window.screen.height == (960 / 2));
var iphone5 = (window.screen.height == (1136 / 2));
@victorbstan
victorbstan / php_object_to_array.php
Created December 17, 2010 04:18
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@brianblakely
brianblakely / rem-calibrate.css
Created July 13, 2012 18:55
Simulate vw with rems
/* Android stock browser won't let you set font-size smaller than 8px unless you apply this. */
:root {
-webkit-text-size-adjust: none;
-moz-text-size-adjust: none;
-ms-text-size-adjust: none;
-o-text-size-adjust: none;
text-size-adjust: none;
}
@mseeley
mseeley / webworker-preloader.html
Created March 3, 2014 09:29
WebWorker Image preloader proof of concept (Tested in Mobile Safari 6.0/IOS 6.1.3 and Chrome 33)
<!DOCTYPE html>
<html>
<head>
<title>WebWorker image preloading</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no" />
</head>
<body>
<div id="output"></div>
<script id="imgloader" type="javascript/worker">
// Not race proof or robust. Proof of concept.