Skip to content

Instantly share code, notes, and snippets.

@simon-saliba
simon-saliba / index.html
Created February 11, 2021 17:52
OAuth client side - Complete example
<script>
var GoogleAuth;
var SCOPE = 'https://www.googleapis.com/auth/drive.metadata.readonly';
function handleClientLoad() {
// Load the API's client and auth2 modules.
// Call the initClient function after the modules load.
gapi.load('client:auth2', initClient);
}
function initClient() {
@umireon
umireon / jxa-timeout.js
Created November 30, 2016 17:52
setTimeout, setInterval, clearTimeout, and clearInterval on JXA (JavaScript for Automation) on macOS
if (typeof exports === 'undefined') exports = {}
function timer (repeats, func, delay) {
var args = Array.prototype.slice.call(arguments, 2, -1)
args.unshift(this)
var boundFunc = func.bind.apply(func, args)
var operation = $.NSBlockOperation.blockOperationWithBlock(boundFunc)
var timer = $.NSTimer.timerWithTimeIntervalTargetSelectorUserInfoRepeats(
delay / 1000, operation, 'main', null, repeats
)
@JawsomeJason
JawsomeJason / _element.scss
Last active August 29, 2019 07:12
Sass Mixin to generate `@element` EQCSS Element Queries
/// Helper for EQCSS Element Queries `@element`
///
/// @author Jason Featheringham
/// @link https://gist.github.com/thejase/d2107285b6e10315dd6bc055115647fe Code source
/// @link http://elementqueries.com/ Plugin to parse EQCSS
/// @link https://gist.github.com/tomhodgins/6237039fa07c2e4b7acd1c8b0f9549a9 EQCSS syntax
///
/// @param {String} $scope (&) - Optional scope. Defaults to current context
/// @param {List} $conditions (()) - 1+ of Maps of EQCSS conditions
/// @content rules to enclose in element query
sudo apt-get update
sudo apt-get install build-essential chrpath libssl-dev libxft-dev -y
sudo apt-get install libfreetype6 libfreetype6-dev -y
sudo apt-get install libfontconfig1 libfontconfig1-dev -y
cd ~
export PHANTOM_JS="phantomjs-2.1.1-linux-x86_64"
wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/$PHANTOM_JS.tar.bz2
sudo tar xvjf $PHANTOM_JS.tar.bz2
sudo mv $PHANTOM_JS /usr/local/share
sudo ln -sf /usr/local/share/$PHANTOM_JS/bin/phantomjs /usr/local/bin
@pchhetri
pchhetri / README.md
Last active February 28, 2024 17:26
OS X iMessage (Messages) database merger

OS X iMessage (Messages) database merger

Use it at your own risk! You might end up worse than before. Backup everything beforehand. Twice.

If you have the Messages app setup in multiple Macs with the same Apple ID you may end up with iMessages (or SMS) scattered around all of these Macs. This is because after a certain time the new iMessages (or SMS) recevied will cease to push to devices afer a certain time has elapsed. Thus, if a computer has been offline for some period of time it won't get the new iMessages.

Each Messages instance stores the information in a SQLite database, to consolidate all these databases run the script below. This is where the Messages app stores the SQLite database under ~/Library/Messages, the folder contents will look like as follows:

  • chat.db
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@davidhund
davidhund / feature-detect flexbox.js
Last active October 17, 2019 16:02
The simplest feature-detect for flexbox?
/*
* Trying to feature-detect (very naive)
* CSS Flexbox support.
* - Only most modern syntax
*
* Is this nonsense?
*/
(function NaiveFlexBoxSupport(d){
var f = "flex", e = d.createElement('b');
@nschum
nschum / README.md
Created September 21, 2014 20:44
OS X Yosemite Messages database merger

OS X Yosemite Messages database merger

Early betas of OS X Yosemite had a bug where the library of old messages wasn't migrated. Instead a new library was created and all old messages were gone.

The bug has been fixed, but if you were affected, you still have two separate libraries. This script merged them for me. Use it at your own risk! You might end up worse than before. Backup everything beforehand. Twice.

This is what your ~/Library/Messages folder will look like if you're affected:

  • chat.db
@dcloud
dcloud / elec_shopping_ch1.markdown
Last active August 14, 2023 14:29
Make Electronics Shopping List

Chapter 1 Parts List

Tools

###Small pliers

RadioShack 4.5-inch mini long-nose pliers, part number 64-0062, or Xcelite 4-inch mini long-nose pliers, model L4G. Or similar. The brand is unimportant. After you use them for a while, you'll develop your own preferences. In particular, you have to decide whether you like spring-loaded handles. If you decide you don't, you'll need a second pair of pliers to pull the springs out of the first.

I have small pliers, probably okay.

@raamdev
raamdev / nginx-mamp-macports.txt
Last active February 24, 2023 08:02
These are the steps to get Nginx running alongside MAMP on a Mac.
# These steps will get nginx installed on your Mac for local development and
# testing purposes, to be used alongside MAMP (which already includes Apache).
# The following steps assume that you're running MAMP and that you already
# have php-cgi in /Applications/MAMP/bin/php/php5.4.10/bin/php-cgi.
# The start-nginx and stop-nginx scripts created at the end do not
# start or stop MySQL because it is assumed that you normally run MAMP
# with Apache + MySQL turned on and that you occasionally want to switch
# your web server to Nginx for testing purposes and that you leave MySQL running.
# This process was tested successfully on OS X 10.9.