Skip to content

Instantly share code, notes, and snippets.

View oswaldoacauan's full-sized avatar
🔮
Snapshot tests are bad. Change my mind.

Oswaldo Acauan oswaldoacauan

🔮
Snapshot tests are bad. Change my mind.
View GitHub Profile
@oswaldoacauan
oswaldoacauan / gist:7040571
Created October 18, 2013 12:02
CSS - Antialias problems in Webkit
/*
Forces webkit to use hardware acceleration
*/
.box {
-webkit-transition: translate3d(0,0,0);
}
@oswaldoacauan
oswaldoacauan / gist:7040581
Created October 18, 2013 12:02
CSS - Prevent flickers on webkit
.box {
-webkit-backface-visibility: hidden;
}
@oswaldoacauan
oswaldoacauan / gist:7081881
Created October 21, 2013 10:42
Javascript - Time Since function
function timeSince(date) {
var seconds = Math.floor(((new Date().getTime()/1000) - date)),
interval = Math.floor(seconds / 31536000);
if (interval > 1) return interval + "y";
interval = Math.floor(seconds / 2592000);
if (interval > 1) return interval + "m";
interval = Math.floor(seconds / 86400);
@oswaldoacauan
oswaldoacauan / gist:7317402
Created November 5, 2013 11:04
CSS - Position Fixed and Scroll on Mobile
.mobile-scrollable {
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
@oswaldoacauan
oswaldoacauan / gist:7580474
Created November 21, 2013 12:06
jQuery - Serialize Form with File inputs
(function($) {
$.fn.serializeFiles = function() {
var form = $(this),
formData = new FormData()
formParams = form.serializeArray();
$.each(form.find('input[type="file"]'), function(i, tag) {
$.each($(tag)[0].files, function(i, file) {
formData.append(tag.name, file);
});
@oswaldoacauan
oswaldoacauan / devices-viewport.js
Created December 16, 2013 11:44
JS - List of devices and his viewports to use with grunt-screenshot, snippet proudly "stolen" from yeoman generator-mobile.
var devices = [
{
name: 'G1',
width: 320,
height: 480,
density: 1
}, {
name: 'Nexus S',
width: 480,
height: 800,
//
// Variables
// --------------------------------------------------
// Global values
// --------------------------------------------------
// Grays
// -------------------------
@oswaldoacauan
oswaldoacauan / styleguide.md
Created May 2, 2014 13:23
Ghostium - Styleguide Markdown
@oswaldoacauan
oswaldoacauan / structure
Created July 1, 2014 17:49
Welcome document
# Architecture
sass/
|
|– base/
| |– _reset.scss # Reset/normalize
| |– _typography.scss # Typography rules
| |– _all.scss # To be imported
| ... # etc…
|
@oswaldoacauan
oswaldoacauan / swfextract
Created March 22, 2015 02:50
SWFExtract All Files
#!/bin/sh
for i in ./*.swf ; do
for j in `swfextract $i | grep -E PNGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract png $j";
swfextract -p "$j" "$i" -o "$i"_"$j".png
done
for j in `swfextract $i | grep -E JPEGs.* -o | grep -E [0-9]+ -o` ; do
echo "$i -> extract jpeg $j";
swfextract -j "$j" "$i" -o "$i"_"$j".jpg
done