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 / gist:204612360042109a33e1d372761ad877
Created June 29, 2018 16:05
Match literal \r\n and trasform to <p></p>
// Match literal \r and literal \n
'<p>' + (str || '').split(/(?:\\[rn])+/g).join('</p><p>') + '</p>';
// Match all carriage returns \r, newlines \n and also literal \r and literal \n
'<p>' + (str || '').split(/(?:\\[rn]|[\r\n]+)+/g).join('</p><p>') + '</p>';
@acemir
acemir / countVisibleWords.js
Last active May 30, 2018 19:52
countVisibleWords
function countVisibleWords(el){
var padding, em, numChars, numWords;
var text = $(el).text();
var textArr = text.split(' ');
var max = el.clientHeight;
var tmp = document.createElement(el.tagName.toLowerCase());
tmp.className = el.className + " -temp";
// document.body.appendChild(tmp);
@acemir
acemir / gist:49ab59e6392008ec3eb2eb0f2ff1eb80
Created November 16, 2017 02:16
Covert line endings of all files in folder to Unix format
find ./ -type f -exec dos2unix {} \;
@acemir
acemir / MyRequestsCompleted.js
Last active March 21, 2016 07:59
Waits multiple ajax calls response
var MyRequestsCompleted = (function() {
var numRequestToComplete, requestsCompleted, callBacks, singleCallBack;
return function(options) {
if (!options) options = {};
numRequestToComplete = options.numRequest || 0;
requestsCompleted = options.requestsCompleted || 0;
callBacks = [];
var fireCallbacks = function() {
@acemir
acemir / Pure javascript utilities
Last active October 7, 2015 04:17
Pure javascript utilities
Pure javascript utilities
@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 / 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 / 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>

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 / 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