Skip to content

Instantly share code, notes, and snippets.

View elmariachi111's full-sized avatar
🦄
meow

Stefan Adolf elmariachi111

🦄
meow
View GitHub Profile
# -*- coding: utf-8 -*-
"""Cleaning_Feature_engineering.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1cyB8vww3lA0GhABA0mGJluHjfA0VnY5u
"""
from google.colab import drive
@elmariachi111
elmariachi111 / truncate.js
Created June 19, 2019 18:54
Javascript: truncate a text along punctuation marks
/*
assume you want to truncate a longer text to a certain amount of characters but you don't want to stop at
word boundaries. Instead lets cut the text at sentence ending punctuation marks like ! ? .
*/
function pos(str, char) {
let pos = 0
const ret = []
while ( (pos = str.indexOf(char, pos + 1)) != -1) {
ret.push(pos)

how to extend vue cli with webpack loader

have fun using this

@elmariachi111
elmariachi111 / SendMailCommand.php
Created October 19, 2018 18:00
PHP / Symfony: create zip file mail attachments in memory
<?php
namespace App\Command;
use Badcow\LoremIpsum\Generator;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use ZipStream\ZipStream;
@elmariachi111
elmariachi111 / encryption.js
Last active March 6, 2018 01:20
blockstagram / key generation & manual encryption
import SimpleCryptoJS from 'simple-crypto-js'
const blockstack = require( 'blockstack' );
const { getPublicKeyFromPrivate } = require('blockstack');
const { encryptECIES, decryptECIES } = require('blockstack/lib/encryption')
...
class App extends React.Component {
componentDidMount() {
@elmariachi111
elmariachi111 / SigninButton.jsx
Created March 5, 2018 17:45
blockstagram / SigninButton.jsx
import React from 'react';
import * as blockstack from 'blockstack'
export default class SigninButton extends React.Component {
onClick (evt) {
evt.preventDefault();
if (this.props.userData) {
blockstack.signUserOut('/');
} else {
@elmariachi111
elmariachi111 / index.jsx
Last active March 6, 2018 00:55
blockstagram / index.jsx
const blockstack = require( 'blockstack' );
const { getPublicKeyFromPrivate } = require('blockstack');
const { encryptECIES, decryptECIES } = require('blockstack/lib/encryption')
...
class App extends React.Component {
constructor() {
super()
this.state = {
Verifying my Blockstack ID is secured with the address 1N9A6gny5PTDiZ1JYZbWbgAskSWTyMuvS7 https://explorer.blockstack.org/address/1N9A6gny5PTDiZ1JYZbWbgAskSWTyMuvS7
Verifying my Blockstack ID is secured with the address 1N9A6gny5PTDiZ1JYZbWbgAskSWTyMuvS7 https://explorer.blockstack.org/address/1N9A6gny5PTDiZ1JYZbWbgAskSWTyMuvS7
@elmariachi111
elmariachi111 / seed.js
Created January 28, 2018 21:44
create a iota seed in plain js
function createSeed(){
const seedsize = 81;
const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ9";
let seed = "";
for (var i = 0, n = chars.length; i < seedsize; ++i) {
seed += chars.charAt(Math.floor(Math.random() * n));
}
return seed;
}