Skip to content

Instantly share code, notes, and snippets.

Create hexagon map
Each hexagon will have attributes attached to it which it modifies the game chit.
Example Hexagon Tile:
Clear
Road +1 Extra Movement Point
Example Hexagon Tile:
Forest -2 Movement Points
Chit
[3] pry(#<DeliveryHandler>)> @file_response
=> {"FileName"=>"191018_173055001",
"StatusType"=>{"Code"=>"U", "Description"=>"Unread"},
"Delivery"=>
{"PackageReferenceNumber"=>[{"Number"=>"1", "Value"=>"124575"}, {"Number"=>"2", "Value"=>"504738"}],
"ShipmentReferenceNumber"=>[{"Number"=>"1", "Value"=>"124575"}, {"Number"=>"2", "Value"=>"504738"}],
"ShipperNumber"=>"03E0R4",
"TrackingNumber"=>"1Z03E0R40200419931",
"Date"=>"20191018",
"Time"=>"133605",
@staycreativedesign
staycreativedesign / gist:999c12683d5deb9006fb049915e1ff89
Created September 22, 2019 18:48
how can I get the id of the image? or how can I view the data image in controller?
$R('#post_content', { plugins: ['', 'alignment', 'counter', 'imagemanager'],
imageUpload: '#{uploader_index_path}',
imageResizable: true,
imagePosition: true,
callbacks: {
image: {
uploadError: function(response)
{
console.log(response.message);
},
def create
blob = ActiveStorage::Blob.create_after_upload!(
io: params[:file][0],
filename: params[:file][0].original_filename,
content_type: params[:file][0].content_type
)
respond_to do |format|
format.json do
render json: {
@staycreativedesign
staycreativedesign / _form.haml
Last active September 22, 2019 07:07
I'm using redactor to as a WYSIWYG editor and having a problem when I try a new Post it obviously cannot find the @post so how can I make it where the user uploads a file then it gets attached IF the user saves the Post?
$R('#post_content', { plugins: ['', 'alignment', 'counter', 'imagemanager'],
imageUpload: '#{upload_images_admin_category_post_path(@category,@post)}',
imageResizable: true,
imagePosition: true,
callbacks: {
image: {
uploadError: function(response)
{
console.log(response.message);
},
@staycreativedesign
staycreativedesign / foo.js
Last active September 22, 2019 06:13
how can i get the data-image attribute while traversing like this image.nodes[0]
image.nodes[0] . gives me this
<figure style="max-width: 296.861px;"><img src="/corsair.jpg" data-image="188" width="100%" height="100%"></figure>
now how do i select the data-image?
@staycreativedesign
staycreativedesign / gist:f5033884869bf3315e1234d7f9201457
Created September 20, 2019 02:36
how in the world would I make this work with active storage..
https://imperavi.com/redactor/plugins/imagemanager/
<script>
$R('#content', {
plugins: ['imagemanager'],
imageUpload: '/your-upload-script/',
imageManagerJson: '/your-folder/images.json'
});
</script>
{
"id": 417,
"elementId": 501,
"siteId": 1,
"title": "1000928 113 street scene with old cars",
"dateCreated": "2019-06-07 17:22:19",
"dateUpdated": "2019-06-07 17:22:19",
"uid": "c1de5419-5df2-4f2f-8fa9-20e7abe74674",
"field_brochuresLink": "NULL",
"field_email": "NULL",
@staycreativedesign
staycreativedesign / console.log
Last active September 18, 2019 18:19
expected out come to have the relation of each entry to one another currently I add a related entry and the other entry is not relating back the association
before adding a related entry
irb(main):001:0> e = Entry.last
Entry Load (0.7ms) SELECT "entries".* FROM "entries" ORDER BY "entries"."id" DESC LIMIT $1 [["LIMIT", 1]]
=> #<Entry id: 112, title: "Route 66", of_type: nil, subtitle: nil, intro: nil, content: "<p>Lorem Ipsum sit amet, consectutuer adipiscing e...", promo: 0, author: nil, address: nil, city: nil, state: nil, zipcode: nil, lat: nil, long: nil, directions: nil, website: nil, email: nil, facebook: nil, twitter: nil, instagram: nil, pinterest: nil, meta_description: nil, meta_keywords: nil, meta_title: nil, created_at: "2019-09-17 18:49:06", updated_at: "2019-09-17 19:24:35", slug: "route-66", topic: nil, type_id: 10, facility: nil, group: nil, internet: nil, room: nil, room_amenities: nil, discounts: nil, is_featured: 0, start: nil, end: nil>
irb(main):003:0> e.related_entries
Entry Load (0.7ms) SELECT "entries".* FROM "entries" INNER JOIN "related_entries" ON "entries"."id" = "related_entries"."other_entry_id" WHERE "related_entries"."en
fun = CSV.open("memberships.csv", "wb") do |csv|
csv << ["id", "name", "email", "street", "state", "city", "zipcode", "country", "phone" "stripe_id", "created_at"]
end
CSV.open("memberships.csv", "a+") do |csv|
Membership.all.each do |mem|
csv << [mem.id, mem.name, mem.email, mem.street, mem.state, mem.city, mem.zipcode, mem.country, mem.phone, mem.stripe_id, mem.created_at]
end