Skip to content

Instantly share code, notes, and snippets.

View anttiviljami's full-sized avatar
💜
Be kind.

Viljami Kuosmanen anttiviljami

💜
Be kind.
View GitHub Profile
@geecu
geecu / vim.textarea.js
Created April 24, 2014 08:12
Enable vim mode for <textarea>s in a page
// add our keyamp from github
var vimBinding = document.createElement('script');
vimBinding.setAttribute('src', 'https://rawgit.com/jakub-m/vim-in-textarea/master/jsvim.js');
// browser support for onload may be iffy ...
vimBinding.onload = function () {
var vim = new VIM();
Array.prototype.forEach.call(document.querySelectorAll('textarea'), function (instance){
""
" anttiviljami's vimrc
"
" twitter: @anttiviljami
" http://seravo.fi
"
""
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
@onnimonni
onnimonni / organize.rb
Created May 14, 2015 17:52
File organizer for large amount of images
#!/usr/bin/env ruby
require 'fileutils'
def createNewFolder
picture_dir = ''
loop do
@thewheat
thewheat / intercom-teachable.com.rb
Last active July 8, 2020 09:57
Integrating Intercom with Teachable.com Power Editor > Templates > Layouts > partials > footer
{% endcache %}
<script>
// TODO: change the instances of APP_ID to your specific app_id value
{% if current_user == null %}
window.intercomSettings = {
app_id: "APP_ID"
};
@anttiviljami
anttiviljami / allow-email-as-username.php
Created March 3, 2016 09:19
A wordpress mu-plugin that allows you to create users with email-addresses as usernames in multisite
<?php
/**
* Plugin name: Allow email as WordPress Network/Multisite username
* Description: A wordpress mu-plugin that allows you to create users with email-addresses as usernames in multisite
* Version: 1.0
* Author: @anttiviljami
* License: GPLv3
*/
add_filter( 'wpmu_validate_user_signup', '_signup_allow_email_as_username' );
@anttiviljami
anttiviljami / wp-admin-modal-dialog.php
Last active October 9, 2024 00:34
WordPress admin modal dialog example
<?php
// enqueue these scripts and styles before admin_head
wp_enqueue_script( 'jquery-ui-dialog' ); // jquery and jquery-ui should be dependencies, didn't check though...
wp_enqueue_style( 'wp-jquery-ui-dialog' );
?>
<!-- The modal / dialog box, hidden somewhere near the footer -->
<div id="my-dialog" class="hidden" style="max-width:800px">
<h3>Dialog content</h3>
<p>This is some terribly exciting content inside this dialog. Don't you agree?</p>
@mieky
mieky / README.md
Created January 8, 2017 08:41
Mike's terminal
@anttiviljami
anttiviljami / response.md
Last active December 13, 2018 08:33
Innowise CMS vs. WordPress (annotoitu)

Linkki alkuperäiseen artikkeliin: http://www.innowise.fi/fi/innowise-cms-vs-wordpress/

part1

part2

part3

1)

WordPress tukee out-of-the-box useita erilaisia käyttäjäryhmiä jotka on jaettu eri rooleihin. Pääkäyttäjän rooli on tarkoitettu sivuston tekniselle ylläpitäjälle, kun taas roolien Päätoimittaja, Kirjoittaja ja Avustaja ylläpitonäkymät on karsittu vähemmän teknisille ylläpitäjille sopiviksi. WordPressin rooleilla voi myös rajoittaa eri ryhmien käyttöoikeuksia esimerkiksi antamalla Avustaja-roolin vain muokata sivuja, muttei julkaista niitä ilman Päätoimittajan tai Pääkäyttäjän lupaa.

@nickovs
nickovs / zbar_lambda_build.sh
Last active December 27, 2023 19:02
A script for building a version of the Zbar library suitable for running in an AWS Lambda instance
#!/bin/bash
# Clear out old images
[ -d "lib" ] && rm -r lib
cat <<EOF > tmp_recipe.sh
# This is the actual container-side recipe
yum groupinstall -y "Development Tools"
cd /root