Skip to content

Instantly share code, notes, and snippets.

@ddaws
ddaws / hour_overlap.py
Last active October 22, 2016 00:57 — forked from BeOleg/hour_overlap.py
Oleg's Challenge
# 1. Create a Python function that gets an integer between 1 - 12 (as an hour) and returns the exact time in hours
# and minutes at which the hands of the clock overlap at this hour
# (for example, for 1, the result will be close to 1:06)
# 2. create a unit test for this function, using 'assert', or the Python 'unittest' framework
# 3. [BONUS]
# a. add also seconds calculation to the return value of the function.
# b. calculate the angle of the hands in 360 degrees system
# taking 12:00 (noon, midnight) as a point of reference
# ATTENTION: You do not need to import any modules to implement this task
@ddaws
ddaws / ajaxSuccessToDataLayer.html
Last active September 11, 2021 13:59
A GTM tag to intercept all successful ajax requests on a page!
<!--
This tag pushes all ajax success events to the data layer. Ajax success events occur when an
ajax requests returns successfully, such as a ajax form submission. Ajax forms are hard to use
as triggers though this tag will expose their resulting data in the data layer to be used for triggers.
-->
<script>
var dataLayer = dataLayer || [];
$(document).ajaxSuccess(function (event, jqXHR, ajaxOptions, data) {
dataLayer.push({
event: event.type,
@ddaws
ddaws / AdWordsScriptRunner.js
Last active October 16, 2023 06:37
Executes AdWords scripts across 50+ accounts in parallel and sequentially
// the script will run across all accounts with exactly this label. If you want the script to run
// accross all accounts just remove this all together
var SCRIPT_LABEL = 'Your Script!';
function run() {
// your script goes here
}
// this will execute your script sequentially accounts and is only used for accounts in excess of 50
function executeInSequence(sequentialIds, executeSequentiallyFunc) {
@ddaws
ddaws / excludePlacements.js
Last active August 27, 2020 23:21
AdWords Negative Match Placements Term
/**
* Removes placements ending in the tlds xyz, tk, and download.
* @author Dawson R
* @author Andrew B
*/
// Top Level Domains to exclude
var TLDs = '.xyz, .tk, .download';

Keybase proof

I hereby claim:

  • I am ddaws on github.
  • I am ddaws (https://keybase.io/ddaws) on keybase.
  • I have a public key ASDVV0k3NcoWjMcTrRRqLTmkKodpe5X8lfYN737U0M2HNwo

To claim this, I am signing this object:

@ddaws
ddaws / Gulp compile solidity contract
Created January 21, 2016 17:00
Gulp compile Solidity
var Web3 = require("web3");
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
var Requidity = require('requidity'), requidity = new Requidity(web3);
PuddingGenerator = require("ether-pudding/generator");
gulp.task('contracts:deploy', (cb) => {
requidity('./contracts/MyContract.sol').then((compiled) => {
@ddaws
ddaws / Logs_Homebrew_cpp-ethereum_02.make
Created January 9, 2016 17:50
/Users/dawsonreid/Library/Logs/Homebrew/cpp-ethereum/02.make
2016-01-09 12:26:53 -0400
make
/usr/local/Cellar/cmake/3.4.1/bin/cmake -H/tmp/cpp-ethereum20160109-2036-a75pow -B/tmp/cpp-ethereum20160109-2036-a75pow --check-build-system CMakeFiles/Makefile.cmake 0
/usr/local/Cellar/cmake/3.4.1/bin/cmake -E cmake_progress_start /tmp/cpp-ethereum20160109-2036-a75pow/CMakeFiles /tmp/cpp-ethereum20160109-2036-a75pow/CMakeFiles/progress.marks
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/Makefile2 all
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f CMakeFiles/cpp-ethereum_BuildInfo.h.dir/build.make CMakeFiles/cpp-ethereum_BuildInfo.h.dir/depend
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f webthree-helpers/utils/libscrypt/CMakeFiles/scrypt.dir/build.make webthree-helpers/utils/libscrypt/CMakeFiles/scrypt.dir/depend
/Applications/Xcode.app/Contents/Developer/usr/bin/make -f webthree-helpers/utils/secp256k1/CMakeFiles/secp256k1.dir/build.make webthree-helpers/utils/secp256k1/CMakeFiles/secp256k1.dir/depend
@ddaws
ddaws / Make libethereum console output
Created January 9, 2016 17:40
Make libethereum error
Scanning dependencies of target ethereum_BuildInfo.h
[ 0%] Built target ethereum_BuildInfo.h
Scanning dependencies of target evmjit
[ 1%] Building CXX object evmjit/libevmjit/CMakeFiles/evmjit.dir/JIT.cpp.o
[ 1%] Building CXX object evmjit/libevmjit/CMakeFiles/evmjit.dir/JIT-c.cpp.o
[ 2%] Building CXX object evmjit/libevmjit/CMakeFiles/evmjit.dir/Arith256.cpp.o
/Users/dawsonreid/Develop/Ethereum/mist/interface/webthree-umbrella/libethereum/evmjit/libevmjit/Arith256.cpp:86:14: error: no member named 'getNextNode' in 'llvm::Argument'
auto y = x->getNextNode();
~ ^
/Users/dawsonreid/Develop/Ethereum/mist/interface/webthree-umbrella/libethereum/evmjit/libevmjit/Arith256.cpp:203:17: error: no member named 'getNextNode' in 'llvm::Argument'
@ddaws
ddaws / make
Created January 9, 2016 16:20
Web3 Umbrella Build Errors
[ 0%] Built target cpp-ethereum_BuildInfo.h
[ 2%] Built target scrypt
[ 3%] Built target secp256k1
[ 3%] Built target dev_BuildInfo.h
Scanning dependencies of target devcore
[ 3%] Building CXX object libweb3core/libdevcore/CMakeFiles/devcore.dir/Base58.cpp.o
[ 3%] Building CXX object libweb3core/libdevcore/CMakeFiles/devcore.dir/Base64.cpp.o
[ 4%] Building CXX object libweb3core/libdevcore/CMakeFiles/devcore.dir/Common.cpp.o
[ 4%] Building CXX object libweb3core/libdevcore/CMakeFiles/devcore.dir/CommonData.cpp.o
[ 4%] Building CXX object libweb3core/libdevcore/CMakeFiles/devcore.dir/CommonIO.cpp.o
@ddaws
ddaws / Update Build Number
Created February 28, 2015 22:14
Update plist CFBundleVersion
#!/bin/sh
PLIST_FILE_NAME="Info.plist"
plist="${SRCROOT}/${PROJECT}/${PLIST_FILE_NAME}"
dir="${SRCROOT}/.."
# Only increment the build number if source files have changed
if [ -n "$(find "$dir" \! -path "*xcuserdata*" \! -path "*.git" -newer "$plist")" ]; then
buildnum=$(/usr/libexec/Plistbuddy -c "Print CFBundleVersion" "$plist")
if [ -z "$buildnum" ]; then