Skip to content

Instantly share code, notes, and snippets.

View cameronwlewis's full-sized avatar

Cameron Lewis cameronwlewis

View GitHub Profile
/*
* Get sentiment from Google Cloud Natural Language API
*/
var getSentiment = function(text) {
var apiKey = PropertiesService.getScriptProperties().getProperty("apiKey")
var url = "https://language.googleapis.com/v1/documents:analyzeSentiment?key=%KEY".replace("%KEY", apiKey)
var data = {
document: {
language: "en-us",
class FirstClass:
def __init__(self, value):
self.value = value
class SecondClass:
def __init__(self):
self.a = 'a'
self.b = FirstClass('b')
def confuse_me(self):
@cameronwlewis
cameronwlewis / README.md
Created December 20, 2018 08:12 — forked from twolfson/README.md
How Python modules are resolved

Python modules have 2 syntaxes for importing.

import x
from x import y

import x

Absolute imports are used for importing top-level modules and only top level modules. These are ones that are globally installed, either inside of Python core or via a package manager (e.g. pip).

@cameronwlewis
cameronwlewis / 0_reuse_code.js
Created March 26, 2017 01:47
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
We couldn’t find that file to show.
@cameronwlewis
cameronwlewis / install_psql_php.sh
Created February 3, 2017 08:47 — forked from giorgiofellipe/install_psql_php.sh
Install PHP PGSQL extensions on Mac OS X Yosemite (change PHP_VER with your PHP version)
PHP_VER="5.5.14"
# Check if extension exists first
php -m | grep pgsql
# Update brew and install requirements
brew update
brew install autoconf
# Download PHP source and extract
@cameronwlewis
cameronwlewis / install_psql_php.sh
Created February 3, 2017 08:46 — forked from doole/install_psql_php.sh
Install PostgreSQL PHP extensions on Mac OS X
#!/bin/bash
# Install Xcode Command Line Tools first (required)
xcode-select --install
# Check PHP version `php --version`
PHP_VER=$(php -v | head -1 | awk '{ print $2 }')
# Extensions directory (default: empty string)
EXT_DIR=""