Skip to content

Instantly share code, notes, and snippets.

View gonzalovazquez's full-sized avatar
💭
Focusing on GraphQL

Gonzalo Vazquez gonzalovazquez

💭
Focusing on GraphQL
View GitHub Profile
$list: pouria josh mladen mason daniel
=author-image
@each $author in $list
.photo-#{$author}
background: image-url("avatars/#{$author}.png")
.author-bio
+author-image
@gonzalovazquez
gonzalovazquez / scrollPlay.js
Last active March 11, 2016 06:28
A very nifty scroll to play script insipired by Vine.From http://jsbin.com/ocupor/1/edit
var video = document.getElementById('video'),
info = document.getElementById('info'),
fraction = 0.8;
function checkScroll() {
var x = video.offsetLeft,
y = video.offsetTop,
w = video.offsetWidth,
h = video.offsetHeight,
r = x + w, //right
@gonzalovazquez
gonzalovazquez / smoothScroll.js
Last active December 21, 2015 04:38
Smooth Scrolling JS
$(function() {
function filterPath(string) {
return string
.replace(/^\//,'')
.replace(/(index|default).[a-zA-Z]{3,4}$/,'')
.replace(/\/$/,'');
}
var locationPath = filterPath(location.pathname);
@gonzalovazquez
gonzalovazquez / connect.js
Last active December 10, 2016 09:40
NodeJS connection to MongoDB
var databaseUrl = "mongolaburl"; // "username:[email protected]/mydb"
var collections = ["Persons"];
var db = require("mongojs").connect(databaseUrl, collections);
//Find a Person
db.Persons.find({sex: "male"}, function(err, users) {
if( err || !users) console.log("No male users found");
else users.forEach( function(maleUser) {
console.log(maleUser);
} );
@gonzalovazquez
gonzalovazquez / subl.bash
Last active August 29, 2015 14:02
Add Sublime command to shell
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
@gonzalovazquez
gonzalovazquez / bash_tips_stricks
Last active August 29, 2015 14:03
Bash tricks and tips
I have marked with a * those which I think are absolutely essential
Items for each section are sorted by oldest to newest. Come back soon for more!
BASH
* In bash, 'ctrl-r' searches your command history as you type
- Input from the commandline as if it were a file by replacing
'command < file.in' with 'command <<< "some input text"'
- '^' is a sed-like operator to replace chars from last command
'ls docs; ^docs^web^' is equal to 'ls web'. The second argument can be empty.
* '!!:n' selects the nth argument of the last command, and '!$' the last arg
@gonzalovazquez
gonzalovazquez / jsc
Created July 26, 2014 15:28
JavaScript via Terminal
sudo ln -F /System/Library/Frameworks/JavaScriptCore.framework/Versions/Current/Resources/jsc /usr/bin
@gonzalovazquez
gonzalovazquez / webfaction
Created July 27, 2014 12:58
Adding FTP Access to secondary users to an individual directory. Webfaction
1. Allow the other user account to locate directories that it has access to within your home directory.
setfacl -m u:secondary_username:--x $HOME
2. Remove the other user’s default access to the applications
setfacl -m u:secondary_username:--- $HOME/webapps/new_app
3. Grant the user read, write, and execute access to the application’s files and directories
@gonzalovazquez
gonzalovazquez / backup.txt
Created July 27, 2014 13:39
Backup current directory in a tar.gz
tar -czf ./backup.tar.gz . --exclude ./backup.tar.gz
@gonzalovazquez
gonzalovazquez / intro-to-redux.js
Last active February 1, 2017 15:33
A simple Redux implementation
/*
HTML Requires:
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js"></script>
*/
const counter = (state = 0,
action) => {
switch (action.type) {
case 'INCREMENT':
return state + 1;