Skip to content

Instantly share code, notes, and snippets.

Having fun

Alexander Fallenstedt Fallenstedt

Having fun
View GitHub Profile
Fallenstedt / Cake.dart
Last active Jan 27, 2019
Stream example
View Cake.dart
import 'dart:async';
class Cake {}
class Order {
String type;
void main() {
final StreamController<Order> controller = new StreamController();
Fallenstedt / dark.js
Created Dec 3, 2018
Slack Dark Theme. add to bottom of src/static/ssb-interop.js:
View dark.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; }
View LazyLoad.js
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 / HelloWorld.sol
Created Sep 13, 2018
An example of solidity. Copy and paste code into and use a JavaScript VM runtime environment.
View HelloWorld.sol
pragma solidity ^0.4.24;
contract HelloWorld {
string public message;
int256 public myNumber;
address public owner;
constructor(string initialMessage) public {
message = initialMessage;
myNumber = 42;
View TestCampaignToken.js
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");
View CampaignToken.sol
pragma solidity ^0.4.24;
import "openzeppelin-solidity/contracts/token/ERC20/StandardToken.sol";
contract CampaignToken is StandardToken {
string public name = "CampaignToken";
string public symbol = "CT";
uint8 public decimals = 5;
uint public INITIAL_SUPPLY = 10000;
View Lottery.sol
pragma solidity ^0.4.17;
contract Lottery {
address public manager;
address[] public players;
constructor() public {
manager = msg.sender;
View AWS ECS Amazon Box Launch Script for WordPress
yum update -y
yum install httpd php php-mysql stress -y
cd /etc/httpd/conf
cp httpd.conf htttpdconfbackup.conf
rm -rf httpd.conf
cd /var/www/html
echo "healthy" > healthy.html
Fallenstedt / lazyLoad.html
Last active Apr 11, 2018
Lazy Load with Intersection Observer
View lazyLoad.html
<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 / log snipper
Created Feb 20, 2018
vscode snippet console log
View log snipper
// 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": [