Skip to content

Instantly share code, notes, and snippets.

View tygas's full-sized avatar
🤓
Pushing blockchain with @dappradar

Crypto Tygas tygas

🤓
Pushing blockchain with @dappradar
View GitHub Profile
@tygas
tygas / dropbox_youtube_dl.sh
Created January 13, 2018 16:00 — forked from danog/dropbox_youtube_dl.sh
Script to download videos from YouTube using Dropbox and IFTTT automation (IFTTT recipe: https://ifttt.com/recipes/277403-download-every-youtube-video-you-add-to-your-watch-later-playlist-automatically)
#!/bin/bash
### Original script by Geoffeg, modified by Roblight and later by me (alias me='alias Danog='Daniil Gentili'')
### How to install this script:
### wget https://gist.github.com/danog/a3963463892f7f7df74a/raw/dropbox_youtube_dl.sh -O ~/dropbox_youtube_dl.sh && chmod 755 ~/dropbox_youtube_dl.sh && ~/dropbox_youtube_dl.sh --install
###
### IFTTT Recipe URL: https://ifttt.com/recipes/277403-download-every-youtube-video-you-add-to-your-watch-later-playlist-automatically
if [ "$1" = "--install" ]; then
if [ -f /usr/local/bin/youtube-dl ]; then echo "Youtube-dl already installed."; else echo "Installing youtube-dl..."; sudo curl https://yt-dl.org/downloads/2015.04.03/youtube-dl -o /usr/local/bin/youtube-dl && sudo chmod a+x /usr/local/bin/youtube-dl && echo "YouTube-dl installed successfully." || echo "Couldn't install YouTube-dl."; fi
.circle--arrow {
display: inline-block;
width: 30px;
height: 30px;
background-color: transparent;
background-image: svg-load('icons/arrow--thin--left.svg');
background-repeat: no-repeat;
background-position: center center;
background-size: initial;
border: solid 2px $blue-dark;
componentDidMount() {
window.addEventListener('scroll', () => this.hideBar());
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
window.onpageshow = function (event) {
if (event.persisted) {
window.location.reload();
}
};
}
@tygas
tygas / bug
Created September 12, 2017 09:04
import React, { Component } from 'react';
class WidgetApp extends Component {
constructor(props) {
super(props);
this.state = { isOpen: false };
}
toggleModal = () => {
@tygas
tygas / del.js
Created September 8, 2017 07:43
let r;
const runTasks = (...tasks) => Promise.all(tasks.map(t => t())).then(r => (r));
const tA = () => new Promise(r => setTimeout(() => r('A'), 1000));
const tB = () => new Promise(r => setTimeout(() => r('B'), 100));
const tC = () => new Promise(r => setTimeout(() => r('C'), 100));
runTasks(tA, tB, tC).then(re => {
console.log(re);
});
let r;
const runTasks = (...tasks) => Promise.all(tasks.map(t => {
"use strict";
debugger;
})).then((r)=> {
console.log(r);
return r;
})
const tA = () => new Promise(r => setTimeout(()=> r('A'), 1000))
@tygas
tygas / console save
Created August 21, 2017 10:08
Save console var as json file
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@tygas
tygas / checkbox_check.js
Created October 24, 2016 11:03
select all checboxed
$('input[type=checkbox]').each(function(checkbox){
$(checkbox).prop('checked', true);
});
@tygas
tygas / post
Created September 13, 2016 08:31
Post
var post = function post(path, params, method) {
method = method || "post"; // Set method to post by default if not specified.
// The rest of this code assumes you are not using a library.
// It can be made less wordy if you use one.
var form = document.createElement("form");
form.setAttribute("method", method);
form.setAttribute("action", path);
for (var key in params) {
@tygas
tygas / mongo_select_deeper_column.js
Created September 17, 2014 11:25
Mongo select deeper column
var cursor = db.VirtualMachine.find().limit(10);//
var map = function() {
emit(this._id, this.Name);
};
var emit = function(key, value) {
print("id: " + key + " Name: " + tojson(value));
};
while (cursor.hasNext()) {