James Bachini

Code

  • ERC20 Carbon Credits | Creating A Depleting Token

    ERC20 Carbon Credits | Creating A Depleting Token

    Carbon credits are used to tokenise finances put towards carbon offsetting. On-chain products often have a purchase and burn mechanism where a user must first purchase the token on a DEX and then manually execute a transaction to burn the token. I had the idea to create a automatically depleting token which you just hold…

  • Advanced ChatGPT Prompt Engineering

    Advanced ChatGPT Prompt Engineering

    By now you have probably experimented with ChatGPT and realised the huge potential this “calculator for words” has. In this article I share the results of my research on how to make the most of this powerful tool. Whether you’re using ChatGPT as a personal assistant or in a professional setting, you’ll find some valuable…

  • Remixd Tutorial | How To Take The Solidity IDE To The Next Level

    Remixd Tutorial | How To Take The Solidity IDE To The Next Level

    I’ve gone full circle from Remix > Hardhat > Foundry > Remix I find that I enjoy coding most when I’m experimenting with ideas and proof of concepts within the Remix IDE at https://remix.ethereum.org However for more serious projects I inevitably find myself moving out of creative mode and into testing mode in either Hardhat…

  • LayerZero Example | How To Send Cross-Chain Messages In Solidity

    LayerZero Example | How To Send Cross-Chain Messages In Solidity

    In this article we are going to look at how to send messages or data from one chain to another. In this LayerZero example we will be sending a string from Ethereum’s Goerli Testnet to Optimisms Layer 2 Goerli Testnet. Cross-Chain Tutorial Video James On YouTube Watch On YouTube: https://youtu.be/rKVhQHmljXM |Subscribe How LayerZero Works LayerZero…

  • How To Debug Solidity Smart Contracts

    How To Debug Solidity Smart Contracts

    If you’ve ever received a “gas message” error which makes no sense in Solidity then you’ve probably come across one of it’s greatest flaws. Error reporting and debugging isn’t great for blockchain developers but in this tutorial I’m going to provide some tips, tools and resources to debug Solidity smart contracts. James On YouTube Watch…

  • RAILGUN 2.0 | ZK Privacy Protocol

    RAILGUN 2.0 | ZK Privacy Protocol

    Railgun just announced the launch of version 2.0 this week and in this article we are going to explore the zero knowledge wallet and discuss why privacy protocols are important. In August 2022 Alexey Pertsev was arrested and he has been imprisoned without trial ever since. He was a developer on a ZK mixer called…

  • Timeframe & Budgets For Web3 Development

    Timeframe & Budgets For Web3 Development

    In this article I’m going to provide a timeframe, gantt chart and budget costs for web3 development projects. This assumes a medium sized project for something like a new, innovative DeFi protocol consisting of 5-10 interconnected smart contracts and around 1000 lines of code plus an external audit and dApp frontend. If you are just…

  • Dynamic Evolving NFTs | How To Create Dynamic NFTs & dApps

    Dynamic Evolving NFTs | How To Create Dynamic NFTs & dApps

    Dynamic NFTs include logic that evolves the underlying data that the NFT contract holds. In this example we will build a picture profile NFT that is upgradeable to an alien 👽 All the source code for this project is available at: https://github.com/jamesbachini/WomenWhoCode Dynamic NFT Smart Contract The Solidity smart contracts will comprise of two tokens:…

  • POAP vs NFT | A Guide With Examples

    POAP vs NFT | A Guide With Examples

    In this article we will look at what POAPs are and how their technology is built on top of NFT standards. We will also look at how to create simple POAPs and NFTs. In the conclusion I’ve put together some thoughts on why I think POAPs should only be used for fun and not for…

  • Complete Introduction To Web3 Tutorial | Fullstack Web3 Development Tutorial

    Complete Introduction To Web3 Tutorial | Fullstack Web3 Development Tutorial

    This video course provides a complete introduction to Web3 development. The Web3 tutorial starts with a simple Hello World smart contract and React frontend before diving in to create something useful on Ethereum mainnet. Introduction To Web3 Development James On YouTube Watch On YouTube: https://youtu.be/RwuG9HluFQY |Subscribe Hello World Smart Contract James On YouTube Watch On…

  • Solidity Token Factory Contract Walkthrough

    Solidity Token Factory Contract Walkthrough

    A token factory contract is used to deploy tokens from a parent contract within Solidity. In this simple example we will be deploying an ERC20 token from our factory contract. James On YouTube Watch On YouTube: https://youtu.be/MY9SoGPGVoo |Subscribe Full source code below and on Github: https://github.com/jamesbachini/Token-Factory-Tutorial We start with a standard ERC20 token using the…

  • Trading The Merge

    Trading The Merge

    Once or twice a year the crypto markets align to provide exceptional trading volumes and volatility. I believe the Ethereum merge will presents one such opportunity for low time frame system trading. James On YouTube Watch On YouTube: https://youtu.be/3ltpF4UGir4 |Subscribe About The Ethereum Merge The merge is happening in just a few days. This is…

  • The State Of CBDC Central Bank Digital Currency

    The State Of CBDC Central Bank Digital Currency

    Nation states across the world are exploring CBDC’s (central bank digital currency). Many governments including France, Canada, Saudi Arabia & China have pilot schemes already in place. The US dollar is the global reserve currency, it’s used throughout the world as a base asset and more recently as a political weapon in the form of…

  • Aligning Founders, VC’s and Stakeholders Interests In A Smart Contract

    Aligning Founders, VC’s and Stakeholders Interests In A Smart Contract

    The blockchain sector prides itself on openness and transparency. Except that is when it comes to early stage VC deals and token allocations. In this article we are going to look at an experimental solidity smart contract which lays out terms, vesting schedules and milestone bonuses on-chain. Team Allocations and VC Unlock Schedules This is…

  • Dune Analytics Tutorial | How To Create A Dune Analytics Dashboard

    Dune Analytics Tutorial | How To Create A Dune Analytics Dashboard

    In this Dune Analytics Tutorial we will look at how the platform works and get up to speed with creating our own queries, visualisations and dashboards to analyse and present blockchain data. Queries, Visualisations & Dashboards Dune Analytics dashboards are built using a 3 step process. First we make SQL queries to pull data into…

  • Ownable vs Permissionless Smart Contracts

    Ownable vs Permissionless Smart Contracts

    One of the beautiful things about smart contracts is they can be permissionless where the developers relinquish control to the community and all users are treated equally. However less than 20% of the top 50 protocols by TVL on Ethereum are using fully permissionless contracts. In this article we will look at why this is,…

  • Solidity Tutorial | Fixed Rate Staking Contract

    Solidity Tutorial | Fixed Rate Staking Contract

    In this tutorial we will create a fixed rate staking contract that pays out 1 token for every 1 token staked per year. The contract will be built on an OpenZeppelin ERC20 token library with additional functionality for staking. The user will stake their tokens which will lock them in the smart contract at what…

  • 3 Examples Of How To Use Assembly In Solidity

    3 Examples Of How To Use Assembly In Solidity

    Ethereum developers can directly use assembly in Solidity to improve the performance of their code. When OpenSea released the Seaport upgrade it reported the use of assembly reduced gas fees by 35% saving it’s users an estimated $460m per year. Today we are going to go through some simple examples of how and when to…

  • Solidity for Beginners

    Solidity for Beginners

    Solidity is the programming language used to develop smart contracts on Ethereum and other compatible blockchains. In this “Solidity for Beginners” tutorial I will take you from setting up solidity tools to deploying your first contract. James On YouTube Watch On YouTube: https://youtu.be/yM6oRMdMiTM |Subscribe Tools & Setup We will be starting in Remix which is…

  • SBTs 👻 | Soulbound Token Solidity Example

    SBTs 👻 | Soulbound Token Solidity Example

    Soulbound tokens are non-transferable digital assets. The core concept is storing on-chain data directly relating to a specific address. This is nothing new but there is potential for a ERC SBT contract to provide a industry standard for how we manage user data. James On YouTube Watch On YouTube: https://youtu.be/yCHeHI8hUY8 |Subscribe Ethereum gas costs make…

  • Solidity Interface Examples | How To Connect The Lego Bricks Of DeFi

    Solidity Interface Examples | How To Connect The Lego Bricks Of DeFi

    Solidity interfaces allow developers to call external contracts from within their own smart contract. This enables us to build on top of the existing DeFi ecosystem. In this tutorial we will be looking at how solidity interfaces work and going through some example code for common tasks. James On YouTube Watch On YouTube: https://youtu.be/GWZmklp7RTg |Subscribe…

  • Hardhat Plugins & Hacks For Solidity Developers

    Hardhat Plugins & Hacks For Solidity Developers

    Hardhat provides a lot of features out of the box but with the addition of some 3rd party plugins and some additional code snippets we can add custom functionality to streamline our testing and migration processes. Top 3 Hardhat Plugins These plugins add a lot of functionality to make your life as a developer easier…

  • Foundry Tutorial | How To Debug & Deploy Solidity Smart Contracts

    Foundry Tutorial | How To Debug & Deploy Solidity Smart Contracts

    Foundry is a Solidity Framework for building, testing, fuzzing, debugging and deploying Solidity smart contracts. In this Foundry tutorial we will cover the following: Introduction To Foundry [Video] James On YouTube Watch On YouTube: https://youtu.be/VhaP9kYvlOA |Subscribe Smart contracts are most often written in Solidity but tested and deployed using Javascript frameworks such as Truffle or…

  • 5 DeFi Growth Metrics For Better Valuations

    5 DeFi Growth Metrics For Better Valuations

    Growth metrics have been used by tech VC’s for years to predict and monitor companies growth patterns. Terms like CAC (Customer acquisition cost) and LTV (Lifetime value) are critical to how we value startups in the traditional space. In DeFi the landscape is different and the metrics that we use are too. However on-chain transparency…

  • How To Generate Artwork For NFT’s With Jang.js

    How To Generate Artwork For NFT’s With Jang.js

    This article explains how to generate artwork for NFT’s like cryptopunks where there are 10,000 profile pictures. Most of the NFT generators you’ll find online are designed for simplicity and ease of use for non-developers. I wanted to create something which was customisable and expandable to allow for more innovative NFT collections. Jang.js “Just Another…

  • Tokenomics Boilerplate | Governance Tokens, Uniswap Buy-Backs and Staking in Solidity

    Tokenomics Boilerplate | Governance Tokens, Uniswap Buy-Backs and Staking in Solidity

    In DeFi a projects success is greatly tied to the effectiveness of the tokenomics. Governance tokens can be distributed to the users to incentivise growth and fees can be used to buy these back on exchange. In this Solidity tutorial we are going to deploy a governance token, a Uniswap v3 liquidity pool, a buy…

  • Introduction To DEX Arbitrage | Intermediate Solidity Tutorial

    Introduction To DEX Arbitrage | Intermediate Solidity Tutorial

    This Solidity tutorial will provide an introduction to DEX arbitrage with real, working, profitable open-source code. Solidity developers have the ability batch multiple swaps together and if they are not profitable revert the entire transaction only paying the transaction fee. The creation of EVM blockchains which have low transaction fees has created a playground for…

  • How To Automate Yield Farming | Harvesting Rewards With A Quick & Dirty Script

    How To Automate Yield Farming | Harvesting Rewards With A Quick & Dirty Script

    Connect wallet, click button, confirm transaction. It gets old pretty quick, especially when you need to do it daily to compound returns. This tutorial takes you through the process of using a block explorer to find functions, calling those functions from a script and then executing to harvest and stake reward tokens. The aim is…

  • How To Make Cross Chain Transfers With Multichain

    How To Make Cross Chain Transfers With Multichain

    I’ve seen Anyswap popping up more and more in on-chain analytics reports as it’s grown to be a six billion dollar protocol by TVL. The platform just rebranded to Multichain and its fast becoming the market leader in cross chain bridges. If you want to transfer USDC from Ethereum to Polygon or Fantom or another…

  • Blockchain Developer Roadmap | A Guide To Learning Blockchain Development

    Blockchain Developer Roadmap | A Guide To Learning Blockchain Development

    This blockchain developer roadmap lays out a framework for learning blockchain development. It should provide a wealth of resources and information for aspiring blockchain developers. Blockchain Developer Roadmap James On YouTube Watch On YouTube: https://youtu.be/h-IcAZX7250 Understanding The Moving Parts There are a number of roles within the blockchain sector and an understanding of what each…

  • Crypto Market Volatility | List Of 100 Altcoin Betas Relative To Bitcoin

    Crypto Market Volatility | List Of 100 Altcoin Betas Relative To Bitcoin

    In this study we are looking at crypto market volatility and how different altcoins markets move relative to Bitcoin. For example if Bitcoin moves up or down 1% Solana will roughly move double that amount for various reasons discussed below. Crypto Market Volatility List FTX Market Beta Volume BTC-PERP 1.01 $4609m ETH-PERP 1.29 $4471m SOL-PERP…

  • How To Create A TradingView Indicator | Easy Pinescript 5 Tutorial

    How To Create A TradingView Indicator | Easy Pinescript 5 Tutorial

    In this Pinescript tutorial we will build out a simple TradingView indicator using the latest version of Pinescript v5. TradingView Indicator Tutorial This video goes through the Tradingview indicator tutorial with more details and code snippets available in the article below. James On YouTube Watch On YouTube: https://youtu.be/gWw6Hv3CuBU Getting Started With Indicators TradingView indicators are…

  • Intermediate Solidity Tutorial | Building On DeFi Lego Bricks With Hardhat 👷

    Intermediate Solidity Tutorial | Building On DeFi Lego Bricks With Hardhat 👷

    In this intermediate solidity tutorial I’ll be building, testing and deploying a smart contract to rebalance a digital asset portfolio. The idea is to look at how we can work with external smart contracts to start building our own products on the lego bricks of DeFi. The Challenge To create a solidity smart contract to…

  • Markdown Tutorial | How To Get Started With Markdown 🖋

    Markdown Tutorial | How To Get Started With Markdown 🖋

    In this markdown tutorial I’ll be showing you how to get started with writing simple markdown for docs and social media before going on to some more advanced concepts and exploring the things you can do with markdown. Markdown Tutorial This video goes through the basics step by step. There are more details, copy &…

  • Arbitrum Tutorial | How To Use The Ethereum Layer 2 Solution

    Arbitrum Tutorial | How To Use The Ethereum Layer 2 Solution

    This Arbitrum Tutorial explores what Arbitrum is and how it works, the opportunities layer 2’s present for investors and developers, before testing the deployment of smart contracts on the Arbitrum network and calculating gas fee reductions. What Is Arbitrum? Arbitrum is a layer 2 scaling solution for the Ethereum network. The L2 has opened it’s…

  • How To Create A New Token And Uniswap Liquidity Pool

    How To Create A New Token And Uniswap Liquidity Pool

    In this article I will create a new token and make it available to swap on a decentralised exchange. I’ll be deploying a solidity smart contract to mint an ERC20 token on Ethereum and setting up a liquidity pool on Uniswap v3. Create A New Token & Liquidity Pool [Video] This video provides an overview…

  • Solidity Tutorial | For Developers Coming From Javascript, C++, Python

    Solidity Tutorial | For Developers Coming From Javascript, C++, Python

    In this Solidity tutorial I’ll be going through the work flow to develop smart contracts on Ethereum using the Solidity programming language. Solidity Developer Tutorial [Video] James On YouTube Introduction To Solidity Smart Contracts Solidity is the programming language of Ethereum and many other blockchains that use the Ethereum virtual machine. A developer will write…

  • Uniswap V3 Trading Bot 🦄

    Uniswap V3 Trading Bot 🦄

    In this tutorial I’ll be explaining how I built Uniswap v3 trading bot in preparation for arbitrage opportunities. We will be looking at why Uniswap v3 is important and how concentrated liquidity pools provide new features such as range orders. I’ll then show how I built and tested the trading bot prior to Uniswap v3…

  • Twitter Trading Bot | Elon + DOGE = Profit

    Twitter Trading Bot | Elon + DOGE = Profit

    In this article I’ll share how I built a Twitter trading bot to trade a cryptocurrency called DOGE every time Elon Musk tweeted something mentioning it. I’ll be using NodeJS to query the Twitter API and then executing trades on FTX. Building A Twitter Trading Bot Video James On YouTube The “Elon Effect” Opportunity Anything…

  • Pine Script Tutorial | How To Develop Real Trading Strategies On TradingView

    Pine Script Tutorial | How To Develop Real Trading Strategies On TradingView

    In this pine script tutorial I’ll be showing you how to get started with TradingView scripting for technical analysis and trading strategy development. We will start by looking at how pine script works and a simple example. From there we will move on to inputs and indicators before creating a complete trading strategy using pine…

  • Solana Tutorial | Building Smart Contracts & dApps For The Solana Hackathon

    Solana Tutorial | Building Smart Contracts & dApps For The Solana Hackathon

    This Solana tutorial goes through a step by step process of setting up a development environment for Solana, writing and deploying smart contracts and my experiences with entering the Solana Hackathon. Getting Started With Solana Solana is a high performance modern blockchain with impressive throughput capabilities. It can handle 50,000 transactions per second which makes…

  • Separating Signal From Noise on WallStreetBets [Niche Website]

    Separating Signal From Noise on WallStreetBets [Niche Website]

    This case study looks at how I went about building a one page website around the trending WallStreetBets community. Creating A Niche Website To Filter WallStreetBets [Video] The Problem & A Simple Solution Starting With A Script Lean Methodology For Niche Websites Marketing A Niche Website Niche Website Monetisation & Financials Conclusion Creating A Niche…

  • Website Competitor Analysis | 5 Steps To Research The Competition 🕵️

    Website Competitor Analysis | 5 Steps To Research The Competition 🕵️

    This article outlines the following five steps to carry out a thorough website competitor analysis. Assessing Competitive Landscape Analyzing Website Traffic Metrics Social Media & Content Analysis Web Technology & Tracking Analysis Personnel & Corporate Structure Research First let’s look at a video example of carrying out competitor research for a Clickbank product. Website Competitor…

  • Google Analytics Event Tracking | GA Events Setup, Tips & Examples

    Google Analytics Event Tracking | GA Events Setup, Tips & Examples

    In this article we will explore what you can do with Google Analytics Events, how to set them up, some example code for where they can be used and some tips for getting the most out of gtag events. Google Analytics Events in 90 Seconds What are Google Analytics Events? Breakdown of an Event Setting…

  • Vanilla HTML | No. 1 Free HTML Boilerplate

    Vanilla HTML | No. 1 Free HTML Boilerplate

    A boilerplate is a starter template which contains the skeleton framework for a development project. Vanilla HTML is a HTML,CSS,JS boilerplate designed for websites with particular focus on SEO and performance marketing. Vanilla HTML in under 2 minutes How Does Vanilla HTML Work? Setting Up Vanilla HTML Why Vanilla HTML over WordPress or React? Vanilla…

  • Browser Automation With Javascript

    Browser Automation With Javascript

    In this article I am going to demonstrate how anyone can learn some simple code to automate common tasks using a standard web browser. Browser automation is a great tool for productivity and scaling up repetitive tasks. James On YouTube What Can Be Automated and Why? Have you ever found yourself carrying out the same…

  • Deno JS | Deno vs Node.JS

    Deno JS | Deno vs Node.JS

    Deno is a Javascript and Typescript runtime from the creator of Node.js For anyone that doesn’t know Node.js is a server-side Javascript runtime. It’s used by millions of projects across the globe and powers the backends and API’s of many of the world’s leading websites. Then came Deno (aka Deno.js or Deno JS), an improved…

  • Lead Magnets, Autoresponders & Tripwires | The Modern Sales Funnel

    Lead Magnets, Autoresponders & Tripwires | The Modern Sales Funnel

    This article is part of a free online course where you can learn digital marketing. Lead magnets, autoresponders and tripwires form key components of a very popular sales funnel. Traffic is pushed into the funnel from traffic sources such as paid ads, content marketing and social media outreach. The visitor is directed to a landing…

  • ReasonLIGO | Building Smart Contracts & Dapps On Tezos

    ReasonLIGO | Building Smart Contracts & Dapps On Tezos

    Tezos smart contracts are compiled from a custom low level language called Michelson. For web developers however learning a new low level programming language is a barrier to entry… Enter LIGO and specifically ReasonLigo. ReasonLIGO  is the most accessible way to develop smart contracts for web developers. ReasonLIGO is based on ReasonML which is based…

  • How do you turn a website into an app in 7 steps

    How do you turn a website into an app in 7 steps

    This is a step by step guide to using a open-source package called Cordova to turn a website into mobile app on Android and iOS. I’ll be using a windows device for this but all the packages are also available for a Mac. To publish an app to the iOS app store you need to…

  • Micro Conversions | Complete Guide To Optimising & Scaling With Micro Conversions

    Micro Conversions | Complete Guide To Optimising & Scaling With Micro Conversions

    What are micro conversions? Micro conversions are minor events such as clicks and scrolls that we can use to track visitor behaviour and optimise advertising and landing pages faster. They are generally not directly linked to key performance indicators for an advertising campaign but can be used to scale (increase traffic volumes) more effectively. James…

  • 8 Tips For The Perfect Blog Post

    8 Tips For The Perfect Blog Post

    This is the revised 2020 complete guide to the best practices when creating content for your blog. You can use this framework to create a “perfect blog post” and move your site up the search engine rankings. James On YouTube The Title The title or headline of a blog post should be a close match…

  • How to encrypt text file in Visual Studio Code (VSCode)

    How to encrypt text file in Visual Studio Code (VSCode)

    I wanted a way to quickly encrypt and decrypt text files in VSCode using a memorised pass phrase so I created an easy to use plugin to encrypt text in Visual Studio Code. VSC has become the text editor of choice for most developers and it is relatively simple to create and publish a plugin…

  • Prevent Mobile Browsers From Turning Off

    Prevent Mobile Browsers From Turning Off

    The following code has been published to prevent mobile browsers from turning off and going into sleep mode. This was affecting setTimeout functions as the javascript code in the browser is effectively paused preventing the event loop from processing once sleep mode is activated. I originally looked at nosleep.js but ended up simplifying the code…

  • Search For Satoshi

    Search For Satoshi

    In 2008 an anonymous user with the alias Satoshi Nakamoto posted the original Bitcoin whitepaper to the Cryptography mailing list. Satoshi mined a lot of the early Bitcoin blocks and the rewards that are held in bitcoin wallets associated are estimated to be around 1 million BTC or 10 Billion USD. If Bitcoin eventually reaches…

  • Pop Under Code 2020

    Pop Under Code 2020

    Updated September 2020 This pop under code is used for running pop under traffic on your own site. It adds an onclick function to every link on the page which opens a new tab with the clicked link and changes the existing window (underneath) to a popped ad URL. Opening links in new tabs isn’t…

  • PHP Redirect with Parameters | Passing GET variables in a Redirect

    PHP Redirect with Parameters | Passing GET variables in a Redirect

    Update March 2023 To do a 301 PHP redirect with parameters to another page we can use the following code: The entire query parameter string is stored in the following variable. Everything after the question mark. So for the URL: server.com/index.php?test=123&hi=hellothe $_SERVER[‘QUERY_STRING’] will contain this string “test=123&hi=hello” We can then pass this out when redirecting…

  • Wasabi AB Testing Platform

    Wasabi AB Testing Platform

    Update July 2020 – Wasabi is no longer maintained or supported. Check this article for more information on conversion rate optimisation. Wasabi AB Testing Platform Intuit have opensourced a enterprise grade A/B testing platform called Wasabi. This runs as an API on a separate server from your site/landers. It isn’t the easiest thing to setup…

  • How to display different banners for mobile

    How to display different banners for mobile

    I had a situation where I wanted to use different ad banners depending on the screen size of the visitor. To display different banners for mobile and desktop traffic. What I wanted was a dynamic ad block that displayed different ads depending on the width of the browser window so it wouldn’t mess up the…

  • robots.txt Disallow All | Block Bots

    robots.txt Disallow All | Block Bots

    In this article we are going to look at how to block bot traffic using the robots.txt disallow all feature, then some of the more advanced uses of the robots.txt file. How To Disallow All in robots.txt Custom robots.txt for Specific Bots and Directories Complete List of Bots – robots.txt How To Disallow All in…

  • Vibrate Phone with Javascript

    Vibrate Phone with Javascript

    The following javascript uses the Vibrate API to make a phone vibrate when a page is loaded. You can time it with setTimeouts or onclick/onscroll if required. There’s more information available at: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/vibrate This can be used to draw a users attention to the landing page or to create message effects etc.

  • Node.js client for Moz API (MozScape)

    Node.js client for Moz API (MozScape)

    Update 2020: This is outdated now and not maintained. I’d recommend using one of these packages: https://www.npmjs.com/package/moz-api https://www.npmjs.com/package/moz-api-wrapper Original Post: I was doing some work with SEO domains and realised there wasn’t a node.js client for the MozScape API… so after Googling and not finding what I was looking for I built one. What this…

  • REGEX | A Complete Guide With Examples

    REGEX | A Complete Guide With Examples

    Regexes are a powerful way to do search queries on a text string. They can be used to replace text, sanitize user inputs and much more. Contents Introduction to REGEX REGEX Cheatsheet REGEX Examples REGEX Javascript Code An Introduction to REGEX A REGEX or regular expression is used to match text strings in many programming…

  • A simple floating feedback/support button

    A simple floating feedback/support button

    Updated for 2020 with a cleaner design. This uses the mail command in PHP to send the email but if this is disabled on your server you can connect it to Sendgrid/Mailchimp/AWS etc for the sending of email queries. There is a working example at: https://jamesbachini.com/misc/feedbackexample.html The code for this is really easy to implement…

  • Alert box on click through to offer

    Alert box on click through to offer

    The following example will allow you to create an alert box when the user clicks through from your landing page to the offer page. This can be useful to remind users of your offers value proposition, sign-up requirements (double-opt in?) or just to increase conversion rate on the offer end. A working demo is available…

  • A simple iOS / Android traffic splitter in PHP

    A simple iOS / Android traffic splitter in PHP

    The following basic PHP code will split traffic by device with iOS traffic going to the first out link, Android to the second and leftovers to the third. TIP: This uses a 301 redirect however you can do any type of programmatic variation based on the user agent. You can copy and paste this into…

  • Splitting traffic to different offers on mobile

    Splitting traffic to different offers on mobile

    If you are buying bulk traffic to a mobile offer the chances are that you can split some of your traffic off to different offers. For example if  you have a pin submit that only accepts android but has a much higher payout then you can separate your android traffic and increase your bottom line.…

  • RAM & CPU Usage PHP Script | Server Health Check

    RAM & CPU Usage PHP Script | Server Health Check

    This single file server health check script works on Windows, Linux and possibly others. It is written in PHP to show CPU usage, RAM usage, Incoming Connections and Hard disk usage. Update September 2020 Server Check PHP was getting a lot of downloads so I’ve updated the code and open sourced it on Github. If…

  • Resize youtube/vimeo iframe to maximum available height and width

    Resize youtube/vimeo iframe to maximum available height and width

    Here is the code to make a flexible youtube.com or vimeo.com video fit both the height and width of the containing div. Like a flexible adsense unit it will take up the maximum available space on the page or be constrained within a containing object such as a div. CSS: .vcontainer { position:relative; padding-bottom:56.25%; padding-top:30px;…

  • Calculate distance between two geocooridnates

    Calculate distance between two geocooridnates

    Here is a javascript function to calculate the distance between two latitude and longitude coordinates. function deg2rad(deg) { return deg * (Math.PI/180) } function calcDistance(lat1,lon1,lat2,lon2) {   var R = 6371; // Radius of the earth in km   var dLat = deg2rad(lat2-lat1);   var dLon = deg2rad(lon2-lon1);   var a =     Math.sin(dLat/2) *…

  • Option to Disable Adsense Ads

    Option to Disable Adsense Ads

    In some cases it is beneficial to provide a link or option for visitors to a site not to see the adsense ads the first time they visit a page. Ads can sometimes be viewed negatively and for the first visit or under certain circumstances it is best to temporarily disable them. Here is the…

  • Automatic Redirect for Mobile Landing Page

    Want a mobile lander with a 90%+ “CTR”? Simply add the following javasript: <script> function go() { location.href = ‘http://www.jamesbachini.com’; } function init() { setTimeout(function() { confirm(‘You have two friends who recommended this app’); },3000); setTimeout(function() { go(); },5000); } </script> Then run the init function on body load like so: <body onload=”init();”> This does…

  • Setting Up Retargeting Pixels for Adwords and Facebook

    Setting Up Retargeting Pixels for Adwords and Facebook

    Retargeting works by placing a image pixel or code snippet on your website. You can then launch advertising campaigns targeted at those specific users that have visited the page and “seen” the hidden pixel. This is how to set it up… Facebook Go to Ads Manager > Audiences > Create Audience > Custom Audience >…

  • Setting up Maxmind GEOIP2 Legacy Database with PHP or Javascript

    This is the php code I use to access geoip data from Maxmind’s geoip database: <?php $gpath = getcwd() . “/GeoIPCity.dat”; if (isset($_SERVER[‘HTTP_X_FORWARDED_FOR’])) { $myip = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; } if (isset($_SERVER[‘REMOTE_ADDR’])) { $myip = $_SERVER[‘REMOTE_ADDR’]; } include(“./geoipcity.inc”); $gi = geoip_open($gpath,GEOIP_STANDARD); $record = geoip_record_by_addr($gi,$myip); $city = $record->city; $countrycode = $record->country_code; geoip_close($gi); echo ‘countrycode = “‘.$countrycode.’”; city =…

  • Dealing With Googles Mobile Friendly Algorithm

    From the 21st April Google will be penalising sites for mobile search which don’t appear mobile friendly. You can test your site here: https://www.google.com/webmasters/tools/mobile-friendly/ If you haven’t done any mobile design you’ll probably get some warnings like this: Text too small to read Links too close together Mobile viewport not set Content wider than screen…

  • Google Friendly Mobile Pages Test

    Google have provided a tool which checks to see if a site renders clearly in a mobile browser. The tool looks like it is setup at 320px and if your site works at this you’ll get a “mobile-friendly” tag in your organic search listings. Here’s the link to check your sites: https://www.google.com/webmasters/tools/mobile-friendly/ Some other good…

  • Passing Through Landing Page Variables

    This was inspired by another post which is well worth a read at: http://affplaybook.com/blog/affiliate-marketing/the-ultimate-guide-to-landing-page-tricks/ So many traffic sources provide you with tags such as {keyword} {countrycode} {device} etc. You can add these variables to your url so it would look something like: http://www.myserver.com/landingpage.htm?kw={keyword}&device={device} Then in the code to your landing page you can access these…

  • Big list of Cordova/Phonegap Plugins

    I needed a big list of Cordova plugins to search through: android.support.v4 This is a Cordova plugin that adds the Android Support v4 client library. It is meant to be depended on by other plugins. android.support.v7-appcompat This is a Cordova plugin that adds the Android Support v7 AppCompat client library. It is meant to be…

  • Email Bounce Handling

    Here’s some PHP code developed to handle bounced email responses. This will give each response a code to $resno and a category to $rescat. There are 4 categories: Unknown – Hard bounce user or email address isn’t valid Spam – Soft bounce, blocked by spam filters Full – Soft bounce, user is out of resources…

  • Coding PHP for Affiliates | A Getting Started Guide

    Coding PHP for Affiliates | A Getting Started Guide

    Coding for me is one of the most important skills you can have as an affiliate marketer. I’ve met plenty of affiliates that are running huge volume, making millions and can’t write a single line of code. “I just outsource it all” but for me I couldn’t imagine coming up with a tweak to a…

  • Direct Linking and Retargeting

    Here is how to do it, you’ll still need a server and a domain. Point all your traffic towards a php file i.e. http://www.mydomain.com/trackandforward.php Then place all your retargeting pixels in to the trackandforward.php file and put a meta refresh at the the end. The page will load the retargeting cookies will be placed and…

  • Automatic backup of MySQL database

    Would you like to have a backup of your critical MySQL database emailed to you automatically? The following script was moified from backup2mail and needs setting up as a cron job, instructions are in the code. Download it for free here This is what the code looks like: <?php /// Setup /// // Test it…

  • Stupidly Simple AB or Multivariate Testing

    Stupidly Simple AB or Multivariate Testing

    Here’s a simple way you can setup a simple multivariate or A/B split test without any software just using the subid variables provided by an affiliate network and some really basic php. <?php $out = ‘http://www.myaffiliatelink.com/page1.php?affid=123&subid1=’; if (rand(0,1) == 0) { $out.=’g1′; $girlimg = ‘1.png’; } else { $out.=’g2′; $girlimg = ‘2.png’; } // this…

  • Redirection Methods and Referer Passing

    The following are some methods you can use to redirect users from one place to another. I generally use 301 redirects for anything where I want the referer passed through because this is the fastest. Double meta refresh for anything where blank referer is important and a custom script which incorporates the form submit redirect…

  • Combining Maxmind GeoIP with Google Maps iFrame

    This is a quick script which uses Maxminds geoip location db downloadable for free from here with Google Maps iFrame. I haven’t tested this enough to find out if Google restrict the number of requests by referrer but you could always put a meta refresh page in the iframe to blank the referrer if thats…

  • Loading a conversion pixel on click through

    Mobile campaign optimisation throws up a number of issues in regard to tracking. One thing I’ve found really useful is to load a conversion pixel on click through from the landing page to the offer page. This can be a traffic source pixel which can then be used to give some indication of site/device/carrier quality…

  • iframe to a specific div id on a landing page

    Below is the code to iframe an offer page but cut out all the stuff you don’t need. This is useful if you just want to iframe the form while using your own images etc. This is setup so you just enter the url and div id you want to jump to at the top…

  • Mobile Multivariate Testing with SubID’s

    Due to slow page load speeds it is advised to keep tracking software to minimum when running mobile campaigns. This caused me a problem when trying to develop and optimise a mobile landing page. Because I wasn’t using prosper or any other tracking software I couldn’t plug in my custom multivariate testing scripts. I was…

  • Prosper202 Mod – Set preferences before crashing server

    Had a bit of an issue with Prosper crashing once the database got too big. I would log out and leave the analysis preferences set to my biggest traffic source and when I logged back in the server would crash as it tries to pull a report before you can modify the search critieria. I…

  • What was that Country Code?

    Have problems remembering all the different country codes for geolocation scripts etc? Switzerland gets me everytime! Here’s a handy list you can use to check before you code. I use Maxmind but this will be accurate for any software that uses the ISO 3166 standard. AD = Andorra AE = United Arab Emirates AF =…

  • Bing URL Ripper for Dorks

    This is a URL ripper which uses bing to search for a dork i.e. “powered by wordpress” and output a list of thousands of wordpress sites. This example was actually setup to rip ning sites but you can adjust accordingly. Written in ruby for linux… #!/usr/bin/env ruby require ‘net/http’ require ‘uri’ class Search def search(search)…

  • UK Postcodes for major cities

    This is useful for PoF advertising. A list of postcodes (Zip Codes) for major cities in the UK. Can be used for all sorts of other uses, as you can see this was formatted for a php geo-targeting script. $postcode[‘London’] = ‘W1D1AP’; // use for england radius 75miles $postcode[‘Birmingham’] = ‘B46QS’; $postcode[‘Leeds’] = ‘LS18TL’; //not…

  • Ruby & Selenium Script to Check Google SERP ranks

    Haven’t used this in a while but it used to work really well untill google would throw a captcha at you after the first 5000 queries. Might be of use to someone. It’s designed for linux and you’ll need selenium up and running to work it. #!/usr/bin/env ruby require ‘rubygems’ gem ‘selenium-client’ require ‘selenium/client’ system(‘java…

  • Captcha Cracker For PHPBB written in Ruby

    It’s been a while since I’ve done much in SEO so I am going to start publishing some of my old scripts. This is a captcha cracker which uses gocr and image magick to decipher phpbb captchas. It’s written in ruby and was designed as part of a backlink building module. You’ll need linux, gocr,…

  • Rotating Offer Pages and Landing Pages in Prosper202

    It is really easy to setup rotation of urls in Prosper but if you actually want to track which url is doing better or you want to test different landing pages it can be a little more challenging. One way to do this is to set each url or landing page up separately and then…

  • Prosper 202 Mods 2012

    Prosper202 mods 1) increase session life – stops it logging you out every five minutes when you are trying to work add the following line just before session_start(); in 202-config/connect.php ini_set(‘session.gc_maxlifetime’,99999); 2) bypass adverts on first page – bit naughty but I prefer to jump straight into the spy section to see whats been going…

  • Custom Facebook Share and Twitter Tweet Buttons as WordPress Widget

    The following is the php code to make your own dynamic Facebook share and Twitter tweet buttons. Just place the images in the root directory and install the Samsarin PHP widget. Copy this code into a Samsarin Php widget and drag it to your sidebar. <a target=”_blank” href=”http://www.facebook.com/sharer.php?u=<?php echo “http://” . $_SERVER[‘HTTP_HOST’]  . $_SERVER[‘REQUEST_URI’]; ?>”><img…

  • Using Adsense Section Targeting

    If you are getting lots of Groupon and Three ads on your adsense niche site the chances are it isn’t optimised correctly. By simply writing a short, keyword rich, snippet of what your site is about and surrounding it in the following tags you can manipulate which ads are shown. <!– google_ad_section_start –> Jet internet…

  • Facebook Share button more effective than Likes?

    A recent post at SEOMoz suggested that their research has found a better correlation between facebook shares than Facebook likes. The full post is here and makes for an interesting read. One of the things that really caught my attention was in the comments and I quote: “After chatting with our Google rep it seems…

  • Custom WordPress 404 Page For SEO

    I have recently been purchasing used domain names from Godaddy Auctions and Dropcatch. When I get the domains the first thing we do is look at what traffic they were pulling for what topics via google cached web search. If there is some good content on there and things we want to keep we will…