Skip to content

Instantly share code, notes, and snippets.

View WagnerMoreira's full-sized avatar

Wagner Moreira WagnerMoreira

View GitHub Profile
sass-convert -F scss -T sass application_styles.css.scss application_styles.css.sass
@WagnerMoreira
WagnerMoreira / gist.js
Created December 20, 2016 19:41 — forked from adammw/gist.js
Spotify Web Player Hacks
// Get the Spotify.Core instance
var spotify = Spotify.Instances.get(/(SPFBIn_\d+)_player/.exec(document.querySelector('[id^="SPFBIn"]').id)[1]);
// Request the 160kbps MP3 url for a specific track
spotify.services.storageResolver.list('spotify:track:0M3adYbGtyRHACP86dey1H', '', function(data) { console.log('Opening MP3 in new window:', a.uri); window.open(a.uri); }, function(e){ console.log('Error:', e); });
const Reducer = {
factory: (actions, initState, beans) => (state = initState, action) => {
if (!(actions.has(action.type))) return state;
return actions.get(action.type)(state, action, beans);
}
};
export default Reducer;
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@WagnerMoreira
WagnerMoreira / installWinUsb.sh
Created May 21, 2016 15:59
Install WInUSB at ubuntu 16 script
#!/bin/bash
sudo apt-get install gcc build-essential libwxbase3.0-dev libwxgtk3.0-dev
tar zxf winusb_1.0.11+vivid1.tar.gz
cd src-dir/src
sed -i -- 's#wxStandardPaths().GetInstallPrefix()#wxStandardPaths::Get().GetInstallPrefix()#g' findFile.cpp
sed -i -- 's#wxStandardPaths().GetDataDir()#wxStandardPaths::Get().GetDataDir()#g' findFile.cpp
cd ..
autoreconf --install
./configure
@WagnerMoreira
WagnerMoreira / angularjs-scedelegate-whitelist
Created October 19, 2015 19:10 — forked from robhimslf/angularjs-scedelegate-whitelist
Populating AngularJS's resource URL whitelist enables the use of remotely located views and partials hosted on a different domain (e.g., Amazon S3).
/*
* Standard AngularjS bootstrap code.
*/
var app = angular.module('remote-partials-views',
['ui.router',
'ngResource',
'ngSanitize']);
/*
* AngularJS is good enough to come with a whitelist for resource URLs. It just
@WagnerMoreira
WagnerMoreira / _centralize.sass
Created September 8, 2015 17:56
Sass mixin to centralize elements
@mixin center($width, $height) {
position: absolute;
left: 50%;
top: 50%;
height: $height;
width: $width;
margin-left: - $width / 2;
margin-top: - $height / 2;
}
@WagnerMoreira
WagnerMoreira / gist:3627507551e38aa3f492
Last active September 6, 2015 05:03 — forked from liamcurry/gist:2597326
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@WagnerMoreira
WagnerMoreira / gpc.sh
Created September 1, 2015 14:35
Git push commit fromhell @666 of doom
#!/bin/bash
CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD)
COMMIT_MESSAGE=$1
echo -e "$(tput setaf 2)** Executing Status command$(tput sgr0)"
git status
echo -e "\n$(tput setaf 2)\n** Executing add command$(tput sgr0)"
git add .

To remove the entire directory from the index,

git rm --cached -r dir