Skip to content

Instantly share code, notes, and snippets.

@pau1m
pau1m / vlad_ngrok
Created June 30, 2016 07:55
Use ngrok with drupal vlad vm
ngrok http -host-header=rewrite mydomain.com:80
@pau1m
pau1m / gignav
Created August 8, 2016 13:54
giganav
/**
* Setup Main Nav in large screen view
*/
//pjm commented out here
jisc.setupMainNavLarge = function() {
//console.log('main nav large firing');
//$('#search').insertAfter('#nav');
////Wrap submenu div around aside and child of primary nav, to match original jisc structure (retaining existing style)
//$('.j-giganav_primary__item__child').each(function(index, value) {
Talk Jisc Team
Day / Hour / 5 mins
Start off reading out from lists. Testing, Deployment, Automation. UX. Coupling.
Link to talks http://conference.scotlandphp.co.uk/schedule/
All talks captured on video but not up yet afaict.
Keynote
======
@pau1m
pau1m / 12block.js
Last active September 9, 2017 13:53
web 3 find transaction in 12th block
let filter = web3.eth.filter('latest')
filter.watch(function(error, result){
if (!error) {
let confirmedBlockId = web3.eth.blockNumber - 12
web3.eth.getBlock(confirmedBlockId, function(error, res){
if (!error) {
if (res.transactions.length > 0) {
res.transactions.forEach(function(txId){
web3.eth.getTransaction(txId, function(error, tx) {
if (!error && tx.to == account) {
@pau1m
pau1m / alicesButton.js
Created March 8, 2017 16:08
alices_button
<html>
<head>
<title>Introduction to Dapps. Simple MetaMask example.</title>
</head>
<body>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque ut vestibulum diam. Nam varius eros eu dui molestie, et dignissim orci pellentesque. Praesent in ultrices magna. Fusce placerat eu nibh ut maximus. Nulla laoreet diam ac est congue, et varius ligula sollicitudin. Donec eu mi et sem hendrerit rhoncus vitae eu quam. Phasellus dictum congue erat. Etiam rutrum vel est eget mollis. Praesent volutpat turpis mi, id molestie sapien auctor consequat. Aenean laoreet elit ut lacus suscipit, sit amet fringilla orci dictum. Nam eget rhoncus neque. Vestibulum blandit eu ex a mattis.
</p>
<div id="meta-mask-required"></div>
<fieldset>
@pau1m
pau1m / aliceButtonSendEther.js
Last active March 8, 2017 17:06
Alice Button Send Ether
function send() {
web3.eth.sendTransaction({
from: web3.eth.coinbase,
to: '0xE767aEB31dAAF66366999F72FB5De2CEEA76c277',
value: web3.toWei(document.getElementById("amount").value, 'ether')
}
@pau1m
pau1m / watchingConfirmation.js
Last active March 9, 2017 12:22
Alice in chains
const Web3 = require('web3')
let web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
let account = '0xE767aEB31dAAF66366999F72FB5De2CEEA76c277'.toLowerCase()
let filter = web3.eth.filter('latest')
filter.watch(function(error, result) {
if (!error) {
let confirmedBlock12 = web3.eth.getBlock(web3.eth.blockNumber - 11)
confirmedBlock12.transactions.forEach(function(txId) {
@pau1m
pau1m / AuthorDonationExample.js
Last active March 15, 2017 16:17
AuthorDonationExample.js
// Tell the compiler what version of Solidity we're using.
pragma solidity ^0.4.4;
// TestRPC HD wallet
// warrior minimum breeze raven garden express solar flavor obvious twenty alpha actress
contract AuthorDonation {
// Accounts for each of the two participants in the contract with the 'address' type.
address author = 0x34f06373e492e6ba87cbcb655ccc1d0951f734d3;
address editor = 0x7a8f86c5c3ca815e182188567cc44ca9738549af;
@pau1m
pau1m / AuthorDonationsTest.js
Last active August 21, 2019 13:55
AuthorDonationsTest.js
// Include web3 library so we can query accounts.
const Web3 = require('web3')
// Instantiate new web3 object pointing toward an Ethereum node.
let web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
// Include AuthorDonation contract
let AuthorDonation = artifacts.require("./AuthorDonation")
// Test with Mocha
contract('AuthorDonation', function(accounts) {
// Setup a variable to hold the contract object.
@pau1m
pau1m / donation.sol.js
Last active May 22, 2022 02:01
Donation smart contract
pragma solidity ^0.4.4;
// TestRPC HD wallet
// warrior minimum breeze raven garden express solar flavor obvious twenty alpha actress
contract Donation {
// Instantiate a variable to hold the account address of the contract administrator
address public owner;