Skip to content

Instantly share code, notes, and snippets.

View acemir's full-sized avatar
🥁
Tocando o terror 🔊🎵🎶

Acemir Sousa Mendes acemir

🥁
Tocando o terror 🔊🎵🎶
View GitHub Profile
@acemir
acemir / modernizr-tests.js
Created July 20, 2012 02:16 — forked from danott/modernizr-tests.js
Custom Modernizr tests that are useful.
/* modernizr-test.js
* Daniel Ott
* 3 March 2011
* Custom Tests using Modernizr's addTest API
*/
/* iOS
* There may be times when we need a quick way to reference whether iOS is in play or not.
* While a primative means, will be helpful for that.
*/
@acemir
acemir / Cross-Browser Enable or Disable MouseScroll Temporanly
Created September 28, 2012 18:55
Cross-Browser Enable or Disable MouseScroll Temporanly
// left: 37, up: 38, right: 39, down: 40,
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
var keys = [37, 38, 39, 40];
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault)
e.preventDefault();
e.returnValue = false;
}
@acemir
acemir / snippet.js
Created September 29, 2012 20:55 — forked from necolas/snippet.js
Optimised async loading of cross-domain scripts
/*
* Updated to use the function-based method described in http://www.phpied.com/social-button-bffs/
* Better handling of scripts without supplied ids.
*
* N.B. Be sure to include Google Analytics's _gaq and Facebook's fbAsyncInit prior to this function.
*/
(function(doc, script) {
var js,
fjs = doc.getElementsByTagName(script)[0],
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@acemir
acemir / iosd
Created October 1, 2012 22:27 — forked from buritica/iosd
Enable Remote Inspector on Mobile Safari
#!/bin/bash
# Open iPhone Simulator on default location for XCode 4.3 if found
[[ -d /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app
# Open iPhone Simulator on default location for XCode 4.2 if found
[[ -d /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app/ ]] &&
open /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@acemir
acemir / WIN_RubyDevKit_init
Created September 13, 2013 17:48
Ruby DevKit init for Windows
1) Download Ruby 1.9.3
2) Download DevKit file from http://rubyinstaller.org/downloads (DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe)
3) Extract DevKit to path C:\Ruby193\DevKit
4) cd C:\Ruby193\DevKit
5) ruby dk.rb init
6) ruby dk.rb review
7) ruby dk.rb install
Source: <http://stackoverflow.com/a/8463500>
@acemir
acemir / JekyllDocs_locale
Created September 13, 2013 20:17
Locale Jekyll Docs
On windows: chcp 65001
Unix like: export LANG=en_US.UTF-8
Source: <http://stackoverflow.com/questions/13146420/my-jekyll-site-cant-build-liquid-exception-incompatible-character-encodings>
@acemir
acemir / flvtomp4ffmpeg.bat
Created August 26, 2015 07:50
Batch convert FLV to MP4 with ffmpeg
@echo off
for %%a in (*.flv) do (
ffmpeg -i "%%a" -c:v libx264 -crf 19 -c:a libmp3lame -q:a 100 "%%a".mp4
)
pause
@acemir
acemir / Pure javascript utilities
Last active October 7, 2015 04:17
Pure javascript utilities
Pure javascript utilities