Skip to content

Instantly share code, notes, and snippets.

View aripalo's full-sized avatar

Ari Palo aripalo

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>WhatsApp jQuery esimerkki</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Google Analytics skripti -->
<script>
@aripalo
aripalo / yammer-group-emails.js
Last active August 29, 2015 14:17
Yammer: get email addresses of group members
/*
* Get email addresses of Yammer group members
* -------------------------------------------
*
* This script works only when everyone in your organization
* has an email of type <FIRSTNAME>.<LASTNAME>@<YOUR-ORGANIZATION-DOMAIN>
* AND
* everyone in your Yammer organization uses real names
* (and therefore have username of type <FIRSTNAME><LASTNAME>)
*
@aripalo
aripalo / README.md
Last active February 10, 2016 16:30 — forked from renier/fix_vbox_net.rb
Add exception to ipfw firewall (fixes Vagrant+VirtualBox with Cisco VPN)

Should work for Vagrant managed VirtualBox virtual machines hosted on OS X (up to OS X Maverics which has ipfw-based firewall. OS X Yosemite has another pf-based firewall so not sure about that...)

Usage:

Run with sudo and pass in your VirtualBox managed VM's vboxnet IP address or address range:

sudo ruby add_ipfw_exception.rb 172.16.0.0/12
@aripalo
aripalo / youtube-playlist-item-titles.js
Last active August 29, 2015 14:20
Get Youtube playlist item titles
function getTitles(optionalTrimPrefix) {
var elems = document.querySelectorAll('#playlist-autoscroll-list .playlist-video-description h4.yt-ui-ellipsis-2');
var titles = [];
for (i = 0; i < elems.length; i++) {
var text = elems[i].textContent;
var title = optionalTrimPrefix ? text.substr(optionalTrimPrefix.length) : text;
if(title) titles.push(title);
}
@aripalo
aripalo / twitter-list-members-to-array.js
Created December 9, 2015 18:14
Get Twitter list members' usernames into array (without using the API etc)
// 1. Scroll down the list members page:
// https://twitter.com/:username/lists/:slug/members
// ProTip™: keep holding down page down button and wait until you reach the end/bottom of the list
// 2. Paste this to dev tools console
var nodeListOfUsers = document.querySelectorAll('#timeline .username');
var listOfUsernames = Array.prototype.slice.call(nodeListOfUsers).map((node) => node.innerText);
// 3. now you got the list members in array at listOfUsernames variable
// make sure it's length equals the members amount visible in Twitter website
(function(w) {
try {
var isHttps = w.location.protocol === "https:";
var hasSniSupport = true;//we default to true
var ua = window.navigator.userAgent;
var isInternetExplorerOnWinXpOrOlder = /MSIE.*Windows\s?((NT)?\s?(([0-5]\.\d))|XP|98|95|NT;)/i.test(ua);
var isAndroid3XorOlder = /Android [0-3]\./i.test(ua);
var isSymbian = /(SymbianOS|Series40|Series60)/i.test(ua);
var isBlackBerry = /BlackBerry/i.test(ua);
@aripalo
aripalo / watchpack-ignore-node-modules.sh
Last active June 30, 2017 14:08
Using webpack and its polling watch feature (via watchpack) can drain CPU which is due to watchpack polling all the npm deps within node_modules folder. This is a quick hack/fix until proper fix is merged & available in watchpack.
#!/bin/bash
# Should be used until https://github.com/webpack/watchpack/pull/23 is merged and available in npm
# See https://github.com/webpack/watchpack/issues/2#issuecomment-135204573 for more info
# Ensure we have npm
if ! hash npm 2>/dev/null; then
echo 'No NPM installed!'
exit 1
fi
@aripalo
aripalo / styles.less
Created October 6, 2016 13:25
Atom with Operator Mono Screensmart
// base styles
atom-workspace,
atom-text-editor {
font-family: "Operator Mono SSm";
font-size: 13px;
font-weight: 400;
line-height: 1.7;
}
local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)'
local italics=$'%{\e[3m%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}${italics}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@aripalo
aripalo / collect-ebignore-files.rb
Last active October 19, 2016 22:07
Parse .ebignore rules and collect included/excluded files
# get files (also hidden ones with dot prefix)
files = Dir.glob("{**/*}", File::FNM_DOTMATCH)
# Remove folders from array as (git)ignore doesn't care about empty folders
files = files.reject { |f| File.directory?(f) }
# Remove .ebignore itself
files = files.reject { |f| f == '.ebignore' }
# Read the .ebignore file