Skip to content

Instantly share code, notes, and snippets.

View cocodrino's full-sized avatar
🏠
Working from home

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
@cocodrino
cocodrino / 1.php
Created February 14, 2018 18:53
php debug on console
<?php
function console_log( $data ){
echo '<script>';
echo 'console.log('. json_encode( $data ) .')';
echo '</script>';
}
if($result_insert->execute()!== false){
@cocodrino
cocodrino / gist:227a39c77fbe81342d56f4a2d42fc487
Created August 3, 2018 15:09
fix error: Your local changes to the following files would be overwritten by merge spacemacs flutter
Caution: this will remove the local changes that you did in the repo, it's usefull to update spacemacs and flutter
git stash save --keep-index
git stash drop
https://prismic.io/
https://strapi.io/
www.netlify.com
graphcms.com
opensource
getdirectus.com
@cocodrino
cocodrino / teclado.sh
Created September 14, 2018 13:54
switch inner laptop keyboard
#!/bin/bash
#/home/me/bin/toggle-keyboard
kb_name='AT Translated Set 2 keyboard'
if xinput list "$kb_name" | grep -i --quiet disable; then
xinput enable "$kb_name"
else
xinput disable "$kb_name"
fi
@cocodrino
cocodrino / guide.txt
Created October 30, 2018 00:46
fix kernel panic arch
this works for me, not neccesary for you...but maybe could help
1) start with arch/manjaro live cd
2) update your packages with sudo pacman -Syy
3) install pacman -S arch-install-scripts
4) mount your partition with mount /dev/sda7 /mnt (in my case is sda7)
5) run arch-chroot /mnt/arch
6) run pacman -S linux
restart your machine!!!...and hopefully this will work
@cocodrino
cocodrino / get system info
Created October 30, 2018 16:17
get OS and system info linux arch
inxi -Fxxxz
@cocodrino
cocodrino / store.js
Created October 31, 2018 17:24
store
const ROOT_SOCKET = `wss://${URL}/socket`;
let socket = new Socket(ROOT_SOCKET);
socket.connect()
let chan = socket.channel("connect:" + guid());
chan.join();
and then I could create a mutation for load the callbacks and call this from my main component
someMutation(state) {
@cocodrino
cocodrino / download
Created November 1, 2018 02:48
download subfolder github
For other users who just want to download a file/folder from github, simply use:
svn export <repo>/trunk/<folder>
e.g.
svn export https://github.com/lodash/lodash.com/trunk/docs
(yes, that's svn here. apparently in 2016 you still need svn to simply download some github files)
Courtesy: Download a single folder or directory from a GitHub repo
@cocodrino
cocodrino / file.js
Created December 8, 2018 03:00
promisify callback
function promisify(func) {
return (...args) =>
new Promise((resolve, reject) => {
const callback = (err, data) => err ? reject(err) : resolve(data)
func.apply(this, [...args, callback])
})
}
@cocodrino
cocodrino / algo.js
Last active January 10, 2019 12:14
como usar promesas (versión rapida y pirata)
//con callbacks debes pasar el callback, cuyo argumento se va a resolver en un futuro...en el siguiente ejemplo el valor de database
//se resolverá en el futuro, luego book y luego user
connectDatabase(function(database){
findAllBooks(database,function(book){
getCurrentUser(database,function(user){
return pickTopRecommendation(books, user);
})
})
})