Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Programming

Interchained shopglobal

💭
Programming
View GitHub Profile
@shopglobal
shopglobal / scopes.txt
Created Aug 6, 2017 — forked from iambibhas/scopes.txt
Sublime Text 2: Snippet scopes
View scopes.txt
Here is a list of scopes to use in Sublime Text 2 snippets -
ActionScript: source.actionscript.2
AppleScript: source.applescript
ASP: source.asp
Batch FIle: source.dosbatch
C#: source.cs
C++: source.c++
Clojure: source.clojure
CoffeeScript: source.coffee
@shopglobal
shopglobal / jQuery.ajaxRetry.js
Created Sep 22, 2017 — forked from yairEO/jQuery.ajaxRetry.js
jQuery AJAX smart retry
View jQuery.ajaxRetry.js
// enhance the original "$.ajax" with a retry mechanism
$.ajax = (($oldAjax) => {
// on fail, retry by creating a new Ajax deferred
function check(a,b,c){
var shouldRetry = b != 'success' && b != 'parsererror';
if( shouldRetry && --this.retries > 0 )
setTimeout(() => { $.ajax(this) }, this.retryInterval || 100);
}
return settings => $oldAjax(settings).always(check)
@shopglobal
shopglobal / spotify.js
Created Oct 2, 2017 — forked from daniel-j/spotify.js
A simple node.js program to listen to Spotify tracks, albums and playlists
View spotify.js
#!/usr/bin/env node
'use strict';
/*
This is a simple Spotify cli-based client with optional Icecast2/shout support!
It should work for non-premium users, but you must connect your Spotify account to Facebook.
Usage:
$ node spotify <spotify uris> <playlist uri> <album uri> <track uri> <etc...>
View clone-all-twitter-github-repos.sh
curl -s https://api.github.com/orgs/twitter/repos?per_page=200 | ruby -rubygems -e 'require "json"; JSON.load(STDIN.read).each { |repo| %x[git clone #{repo["ssh_url"]} ]}'
@shopglobal
shopglobal / load-hbs-partials.js
Created Oct 31, 2017 — forked from benw/load-hbs-partials.js
Loads partial handlebars templates from files in a directory
View load-hbs-partials.js
// Helps with this problem:
// http://stackoverflow.com/questions/8059914/express-js-hbs-module-register-partials-from-hbs-file
var hbs = require('hbs');
var fs = require('fs');
var partialsDir = __dirname + '/../views/partials';
var filenames = fs.readdirSync(partialsDir);
@shopglobal
shopglobal / udemy-course.sh
Created Nov 3, 2017 — forked from bahdcoder/udemy-course.sh
Installation of Laravel on Ubuntu 16 server
View udemy-course.sh
#
# Requirements:
# - Ubuntu server
# - Root password for ubuntu server
# ssh into the server from local computer
ssh root@{server_name or server_ip_address}
#Updating ubuntu base packages
@shopglobal
shopglobal / post-receive
Created Nov 3, 2017 — forked from sergeylukin/post-receive
Git hook (post-receive): update working tree on PUSH
View post-receive
#!/bin/sh
#
# This hook is placed in Bare repository and it updates Working tree whenever a PUSH
# is executed
#
# Assuming following file structure:
# .
# |-- myproject
# |-- myproject.git
# set WORKTREE=../myproject
@shopglobal
shopglobal / how-to-install-latest-gcc-on-ubuntu-lts.txt How to install latest gcc on Ubuntu LTS (12.04, 14.04, 16.04)
View how-to-install-latest-gcc-on-ubuntu-lts.txt
These commands are based on a askubuntu answer http://askubuntu.com/a/581497
To install gcc-6 (gcc-6.1.1), I had to do more stuff as shown below.
USE THOSE COMMANDS AT YOUR OWN RISK. I SHALL NOT BE RESPONSIBLE FOR ANYTHING.
ABSOLUTELY NO WARRANTY.
If you are still reading let's carry on with the code.
sudo apt-get update && \
sudo apt-get install build-essential software-properties-common -y && \
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
@shopglobal
shopglobal / cryptocurrency-converter.js
Created Dec 15, 2017
Google Sheets Cryptocurrency Converter Script
View cryptocurrency-converter.js
function performLookups() {
convertCrypto('BTC', 'USD', 2, 3);
convertCrypto('LTC', 'USD', 3, 3);
convertCrypto('ETH', 'USD', 4, 3);
}
function convertCrypto(symbol, currency, row, column) {
var url = 'https://min-api.cryptocompare.com/data/price?fsym=' + symbol + '&tsyms=' + currency;
var response = UrlFetchApp.fetch(url);
var json = response.getContentText();
@shopglobal
shopglobal / get-current-crypto-prices.js
Created Dec 15, 2017 — forked from gmcdev/get-current-crypto-prices.js
Map current cryptocurrency prices into Google Sheets
View get-current-crypto-prices.js
/* USAGE:
* Sheet -> Tools -> Script Editor...
* Paste this script
* Update the map (below) to your preferences
* Create a button in your Sheet and Assign Script: `test`
* et voila profit
*/
function test() {
// maps currencies.tokens to sheet ranges
getPrices({