Skip to content

Instantly share code, notes, and snippets.

View Fallenstedt's full-sized avatar
:octocat:
Having fun

Alexander Fallenstedt Fallenstedt

:octocat:
Having fun
View GitHub Profile
@Fallenstedt
Fallenstedt / TestCampaignToken.js
Created September 5, 2018 22:27
TestCampaignToken
const CampaignToken = artifacts.require("CampaignToken");
contract("CampaignToken", async accounts => {
it("should deploy with an inital supply", async () => {
const instance = await CampaignToken.deployed();
const totalSupply = await instance.totalSupply();
console.log("totalSupply", totalSupply);
assert.equal(10000, totalSupply, "balance is not equal");
});
});
@Fallenstedt
Fallenstedt / CampaignToken.sol
Created September 5, 2018 22:26
Example Token
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
// https://theethereum.wiki/w/index.php/ERC20_Token_Standard
contract CampaignToken is StandardToken {
string public name = "CampaignToken";
string public symbol = "CT";
uint8 public decimals = 5;
uint public INITIAL_SUPPLY = 10000;
@Fallenstedt
Fallenstedt / Lottery.sol
Created August 17, 2018 22:36
Lottery.sol
pragma solidity ^0.4.17;
contract Lottery {
address public manager;
address[] public players;
constructor() public {
manager = msg.sender;
}
#!/bin/bash
yum update -y
yum install httpd php php-mysql stress -y
cd /etc/httpd/conf
cp httpd.conf htttpdconfbackup.conf
rm -rf httpd.conf
wget https://s3-eu-west-1.amazonaws.com/acloudguru-wp/httpd.conf
cd /var/www/html
echo "healthy" > healthy.html
wget https://wordpress.org/latest.tar.gz
@Fallenstedt
Fallenstedt / lazyLoad.html
Last active April 11, 2018 21:00
Lazy Load with Intersection Observer
<img class="lazy" data-src="/some/big/ass/image/that/takes/forever/to/load.jpg" src="/some/small/blurry/image/that/is/shown/first.jpg" alt="The pic">
@Fallenstedt
Fallenstedt / log snipper
Created February 20, 2018 21:16
vscode snippet console log
{
// Place your snippets for typescript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('=~*~=~*~=~*~=~*~=~*~=');",
@Fallenstedt
Fallenstedt / generateXlsx.js
Created January 31, 2018 00:55
generate n .xlsx files from a source template using a list of names
var fs = require('fs');
var XLSX = require('xlsx');
console.log('app starting')
const SOURCE = './source/listOfFilesYouWantToGenerate.xlsx';
const QUESTIONS = './source/sourceFileThatNeedsToBeCopiesManyTimes.xlsx';
const TARGET = './vendors';
const sourceFile = XLSX.readFile(SOURCE);
@Fallenstedt
Fallenstedt / gist:af208cb7737ffe03048fa1620292de4a
Created January 2, 2018 01:11 — forked from paulallies/gist:0052fab554b14bbfa3ef
Remove node_modules from git repo
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
@Fallenstedt
Fallenstedt / Bridge Ports across a VM
Last active January 18, 2018 22:07
bridge ports from a VM to root
netsh interface portproxy add v4tov4 listenport=8001 listenaddress=127.0.0.1 connectport=8001 connectaddress=10.0.2.2
# Change listenport and connectport to the port you desire
Working on a mac and need to test on IE 11 or Edge with a local dev build? Get a VM for the browser you need from developer.microsoft.com
Then open command prompt as admin and pase the code above with the port you need. As an example I may have a local sever on port 3000 on mac.
I need my VM to see this port. I replace connectport and listen port with 3000 and paste this magical line into command prompt to build
the bridge I need.
// Default font size set by browsers 16px
$browser-context: 16;
// Calculates the rem value so it can be applied everywhere;
//
// @param an integer font size in px
// @param an integer reference size in px
// @return a string with rem unit.
//
@function rem($pixels, $context: $browser-context) {