Skip to content

Instantly share code, notes, and snippets.

@joshellington
joshellington / kagi-darkmustard-theme.css
Last active April 28, 2024 15:54
A slightly refined, dark-focused, mobile-supported Kagi theme. Works best using Dark Theme, and either Moon Dark or Royal Blue.
:root {
--font-main: "Inter", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
--font-lufga: "Inter", system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
.theme_dark, .theme_moon_dark, .theme_moon_dark_conditional {
--app-bg: #181715;
--page-text: #F2E6D7;
--primary: #F2E6D7;
@joshellington
joshellington / sftp-ubuntu.md
Created March 28, 2012 07:07
Basic tutorial for creating a SFTP-only user on Ubuntu 9.04 and greater

Adding SFTP-only user to Ubuntu Server

To add a SFTP-only user, you'll need to make sure your SSH config settings are correct, add a new user/group and set permissions for your new user. For step-by-step directions, see below. Omit sudo if you're logged in as root.

Directions

  1. Edit /etc/ssh/sshd_config and make sure to add the following at the end of the file:

     Match group filetransfer
    

ChrootDirectory %h

env RAILS_ENV=production DATABASE_URL=scheme://user:pass@127.0.0.1/dbname bundle exec rake assets:precompile 2>&1
fb_query = {
:impressions => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_impressions' AND period=0",
:impressions_unique => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_impressions_unique' AND period=0",
:consumptions => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_consumptions' AND period=0",
:consumptions_unique => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_consumptions_unique' AND period=0",
:stories => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_stories' AND period=0",
:storytellers => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_storytellers' AND period=0",
:engaged_users => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_engaged_users' AND period=0",
:negative_feedback => "SELECT value FROM insights WHERE object_id='#{post_id}' AND metric='post_negative_feedback' AND period=0"
}
def save_thumb media_id
local_path = Rails.root.to_s + '/public/media_thumbs/thumbapp_' + media_id + '.png'
remote_path = 'http://emgklovf.rtmphost.com/http/thumbnail_app/thumbapp_'+media_id+'.png'
open(local_path, 'wb') do |file|
file << open(remote_path, :ssl_verify_mode => OpenSSL::SSL::VERIFY_NONE).read
end
end

#Archive Process

##What you need

  • Fresh clone of the git repo : zipped
  • Screen shots of every unique page : in a folder zipped
  • Folder with all (production) assets if not in repo : zipped
  • Export of the Facebook insights : all exports
  • Export of any other tracking data
  • Dump of the database if needed : NO USER DATA
@joshellington
joshellington / wp-path.php
Created March 27, 2012 20:18
wordpress image path
function get_image_path($img_src) {
global $blog_id;
if (isset($blog_id) && $blog_id > 0) {
$imageParts = explode('/files/', $img_src);
if (isset($imageParts[1])) {
$img_src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
}else {return $imageParts ;}
}
return $img_src;
}
function deleteAllCookies() {
var cookies = document.cookie.split(";");
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i];
var eqPos = cookie.indexOf("=");
var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT";
}
}
$.getJSON('https://graph.facebook.com/me/likes?access_token='+response.authResponse.accessToken+'&callback=?', function(d) {
console.log(d.data);
});
var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase()));
if (mobile) {
// DROPKICK
}