Skip to content

Instantly share code, notes, and snippets.

@olimart
olimart / color-extract.js
Created October 19, 2018 13:43
color-extract.js
const getColors = require('get-image-colors');
const imageURL = "https://images.unsplash.com/photo-1539806190169-9b25397a73b6"
function extractColor(url = imageURL) {
const c = here(url)
return formattedPalette(c)
}
function here(url) {
getColors(url).then(colors => {
@olimart
olimart / supportive_changelog.js
Last active January 30, 2018 03:19
supportive_changelog.js
if (typeof SUPPORTIVE_config !== 'undefined') {
var siteId = SUPPORTIVE_config['account']
// console.log(siteId);
var baseUrl = "//s3.us-east-2.amazonaws.com/supportive"
var apiUrl = baseUrl + "/changelogs/" + siteId + "/changelog.json"
var changelogKey;
var changelogIds = [];
fetch(apiUrl)
.then(
@olimart
olimart / sublime.json
Last active November 2, 2018 14:52
Sublime 3 Settings
{
"auto_complete": true,
"bold_folder_labels": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"command": "dev_docs_search_selection",
"copy_with_empty_selection": true,
"detect_indentation": false,
"ensure_newline_at_eof_on_save": true,
"folder_exclude_patterns":
[
@olimart
olimart / gravitons.scss
Last active September 19, 2016 19:52
Gravitons : Virtually massless CSS layout microlibrary
/* White Space */
$space-1: .5rem;
$space-2: 1rem;
$space-3: 2rem;
$space-4: 4rem;
.m1 { margin: $space-1 }
.mb1 { margin-bottom: $space-1 }
.mt1 { margin-top: $space-1 }
@olimart
olimart / search.js
Last active August 29, 2015 14:17
Node search
//helper method for writing out json payloads
var json = function(res, data) {
res.writeHead(200, { 'Content-Type': 'application/json; charset=utf-8' });
if(typeof data === "string") res.write(data);
else res.write(JSON.stringify(data));
res.end();
};
@olimart
olimart / current_page.rb
Last active August 29, 2015 14:13
Current Page Active
module ApplicationHelper
def is_active?(link_path)
current_page?(link_path) ? "active" : ""
end
end
<li class="<%= is_active?(some_path) %>">
<%= link_to "name path", some_path %>
</li>
@olimart
olimart / app_template.rb
Last active August 29, 2015 14:00
RoR app generator
# rails new generator -d postgresql -m /path/to/app_template.rb
# FILES
# ------------------------------------------------------------------------------------------------------
remove_file 'README.rdoc'
create_file 'README.md', "# Readme
## Getting started
1. Clone and rename database.sample.yml
@olimart
olimart / .irbrc
Last active April 9, 2020 04:22
nano ~/.irbrc with Hirb config.
if ENV['RAILS_ENV']
IRB.conf[:PROMPT_MODE] = :SIMPLE
require 'irb/completion'
require 'hirb'
# Hirb.enable
Hirb.enable output: {"ActiveRecord::Base" => {class: :auto_table, ancestor: true, options: {vertical: true}}}
end
Commit Message [T: 2:03]
Commit Message [t:2:3]
Commit Message [t:2]
Commit Message [T: 3]
Commit Message [ t : 4]
Commit Message [ T: 5]
Commit Message [t:120]
Commit Message [t:2 : 03]
Commit Message [t: 2 : 03 ]
Commit Message [t:2h:03]