Skip to content

Instantly share code, notes, and snippets.

@incogneato
incogneato / engines.md
Created April 21, 2021 12:12 — forked from pioz/engines.md
Using webpacker inside a Rails engine

Using in Rails engines

If the application UI consists of multiple frontend application, you'd probably like to isolate their building too (e.g. if you use different frameworks/versions). Hence we needed our webpack(-er) to be isolated too: separate package.json, dev server, compilation process.

You can do this by adding another Webpacker instance to your application.

This guide describes how to do that using Rails engines.

Step 1: create Rails engine.

@incogneato
incogneato / street-suffix-abbreviations.json
Created September 19, 2020 04:02 — forked from mick-io/street-suffix-abbreviations.json
C1 Street Suffix Abbreviations from USPS. The keys represent the USPS standard abbreviations, the arrays contain primary and commonly used suffixes and abbreviations.
{
"ALY": [
"ALLEY",
"ALLEE",
"ALLY"
],
"ANX": [
"ANEX",
"ANNEX",
"ANNX"
@incogneato
incogneato / active.md
Created April 4, 2020 20:55 — forked from paulmillr/active.md
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Tue, 06 Dec 2016 17:06:46 GMT till Wed, 06 Dec 2017 17:06:46 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user => user.followers > 1000)
@incogneato
incogneato / github-languages-stats.json
Created April 4, 2020 20:54 — forked from paulmillr/github-languages-stats.json
Most active GitHub users raw data
{
"Total": 963
}
@incogneato
incogneato / user_agents.txt
Created January 15, 2019 03:08
User-Agent List
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.97 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36',
'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gec
# username = "my_username"
# pwd = "my_password"
# target_path = "my_target_path"
# saving auth cookie
system %Q{wget --save-cookies /tmp/cookie.txt --keep-session-cookies --post-data "username=#{username}&password=#{pwd}" -O - \
https://rubytapas.dpdcart.com/subscriber/login?__dpd_cart=d08391e6-5fe2-4400-8b27-2dc17b413027}
(25..600).each do |i|
class Activity < ActiveRecord::Base
belongs_to :user
belongs_to :target, :polymorphic => true
default_scope :order => 'activities.created_at DESC', :limit => 10
AUDITION_POSTED = 1 #target --> model audition
AUDITION_FEEDBACK_UPDATED = 2 #target --> model audition
AUDITION_VIEWED = 3 #target --> model video
NEW_PART = 4 #target --> model part
@incogneato
incogneato / mapper.rb
Last active December 15, 2015 01:59
redefine the map method.
class Array
def mapper(&block)
sweet_new_array = []
self.each do |i|
sweet_new_array << block.call(i)
end
sweet_new_array
end
end
@incogneato
incogneato / _form.html.erb
Created December 6, 2012 06:46
Updated Squirrly New Event Partial (FB style)
<div id="events_form">
<div id="form_header"><h4>Create New Event</h4></div>
<% if @event.errors.any? %>
<ul>
<% @event.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
<% end %>
@incogneato
incogneato / ev.css
Created December 6, 2012 02:07
Squirrly Styling - Event Form
div#events_form {
margin-top: 40px;
margin: auto;
border: 8px solid #666;
border-radius: 5px;
width: 50%;
height: auto;
font: 11px verdana;
clear: both;
}