Skip to content

Instantly share code, notes, and snippets.

View jiin's full-sized avatar
🍉
Working from home

Neri Barnini jiin

🍉
Working from home
  • Florence, Italy
View GitHub Profile
@jiin
jiin / css-units-best-practices.md
Created December 15, 2016 12:58 — forked from basham/css-units-best-practices.md
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@jiin
jiin / index.html
Last active August 29, 2015 14:25
cool image animation
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Your Website</title>
<style>
body {
overflow: hidden;
//
// CanvasCamera.js
// PhoneGap iOS Cordova Plugin to capture Camera streaming into a HTML5 Canvas or an IMG tag.
//
// Created by Diego Araos <[email protected]> on 12/29/12.
//
// MIT License
cordova.define("cordova/plugin/CanvasCamera", function(require, exports, module) {
var exec = require('cordova/exec');
// made for bitlanders.com
.factory('middlaw', ['$rootScope', function($rootScope) {
var scopePrototype = Object.getPrototypeOf($rootScope);
var cache = [];
var colors = {
'$apply': '#8e44ad',
'$digest': '#3498db',
'$timeout': '#f1c40f'
@jiin
jiin / nl2br.js
Created March 4, 2015 13:29
nl2br
.filter('nl2br', function () {
return function (text) {
return (text + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + '<br>' + '$2');
}
})
// <img ng-repeat="n in q.r.gems | range"
.filter('range', function() {
return function(total) {
var to = parseInt(total);
var iterations = [];
for(var i = 0; i < to; i++)
iterations.push(i);
return iterations;
@jiin
jiin / ng-geolocation.js
Created September 30, 2014 23:22
ng-geolocation.js
testApp.directive('ngGeolocation', function() {
return {
restrict: 'A',
scope: {
loc: '='
},
link: function (scope, element, attrs) {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) {
var lat = position.coords.latitude,
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
import urllib.request,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)