Skip to content

Instantly share code, notes, and snippets.

@leandrowd
leandrowd / checkType.js
Last active August 29, 2015 14:15
Real type checking
// Real type checker
module.exports = function (object) {
return Object.prototype.toString.call(obj).slice(8, -1)
}
@leandrowd
leandrowd / appendCss.js
Last active August 29, 2015 14:15
WaitFor
module.exports = function(file, title) {
var cssFile = document.createElement("link");
cssFile.setAttribute("rel", "stylesheet")
cssFile.setAttribute("type", "text/css")
cssFile.setAttribute("href", file);
cssFile.setAttribute("title", title);
document.getElementsByTagName("head")[0].appendChild(cssFile);
}
@leandrowd
leandrowd / README.md
Last active August 29, 2015 14:14
Breakpoints css + javascript

Breakpoint detector

How to use

  • Add all snippets to your source (css, js);
  • Invoke the mixin inside your css @include breakpoints-for-javascript;;
  • Call the function breakpoint() and test the result against the strings (mobile|tablet|desktop|large);

i.e: breakpoint() === 'mobile'

@leandrowd
leandrowd / dev-tools
Created October 2, 2014 05:26
Linux machine bootstrap
#Updating the repo
#Adding google chrome keys
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
#updating the apt-get with the new repos
sudo apt-get update
#build/compiling tools
@leandrowd
leandrowd / .bash_aliases
Last active August 29, 2015 14:07
bash files
alias ..="cd .."
alias ..2="cd ../.."
alias ..3="cd ../../.."
alias ..4="cd ../../../.."
alias ..5="cd ../../../../.."
alias hothouse='cd ~/Documents/dev/hothouse'
alias serv-this='python -m SimpleHTTPServer 8000'
alias log-nice="git log --pretty=format:'%C(yellow)%h%Cred%d%Creset - %C(cyan)%an %Creset: %s %Cgreen(%cr)'"
@leandrowd
leandrowd / anagram.js
Last active July 27, 2017 01:34
Anagram checker
var fs = require('fs'),
filename = 'wordlist.txt',
anagramChecker;
function anagram(rawList){
return function (word){
var list = rawList.slice(),
matched = [];
while(wordFromList = list.shift()){
@leandrowd
leandrowd / format
Created July 9, 2014 13:09
Format decimal numbers
function format(number){
var str = ""+ number,
arr = str.split('').reverse(),
formatted = [],
ret;
arr.unshift('-');
for(var x = 1, len = arr.length; x <= len; x++){
formatted.push(arr[x]);
@leandrowd
leandrowd / group-render.js
Created July 5, 2014 08:57
Ember handlebars helper to avoid multiple metamorph tags inside an each block
import Ember from 'ember';
/**
* Ember handlebars group helper
*
* This helper will solve most of problems refering to metamorph
* tags inside a each block. You should use it when you don't need the two-way
* data binding inside your loop.
*
* Adapted from: https://github.com/emberjs/group-helper
//jQuery 1.8+
console.log($._data($("#element")[0]).events);
# Debugging Android Stock Browser using Weinre and Ngrok
This doc will show how to debug any mobile browser that doesn't have a good debug tool.
If your local website can be exposed to your device, you don't need install the Ngrok.
## Step-by-step
- Install the weinre app: `sudo npm -g install weinre`