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 / 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 / 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 / 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">
#!/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 / 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;
}
@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 / 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 / HelloWorld.sol
Created September 13, 2018 16:54
An example of solidity. Copy and paste code into http://remix.ethereum.org/ and use a JavaScript VM runtime environment.
pragma solidity ^0.4.24;
contract HelloWorld {
string public message;
int256 public myNumber;
address public owner;
constructor(string initialMessage) public {
message = initialMessage;
myNumber = 42;
@Fallenstedt
Fallenstedt / LazyLoad.js
Created November 13, 2018 19:37
LAZY LOAD YO
import 'intersection-observer'
/**
* Creates a new LazyLoader.
*
* Will search for images and video elements that have a class of 'lazy'
* It will then Target the element's `data-src` / data-srcset property and then
* Lazily load the content with an IntersectionObserver or
* a fallback method for ancient browswers.
*
@Fallenstedt
Fallenstedt / dark.js
Created December 3, 2018 19:00
Slack Dark Theme. add to bottom of src/static/ssb-interop.js:
//... add at bottom of file
document.addEventListener('DOMContentLoaded', function () {
$(`<style></style>`).appendTo('head').html(`body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }