Skip to content

Instantly share code, notes, and snippets.

@ourmaninamsterdam
ourmaninamsterdam / LICENSE
Last active July 24, 2024 17:00
Arrayzing - The JavaScript array cheatsheet
The MIT License (MIT)
Copyright (c) 2015 Justin Perry
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
@arjunvenkat
arjunvenkat / gist:1115bc41bf395a162084
Last active January 12, 2024 05:04
Seeding a Rails database with a CSV file

How to seed a Rails database with a CSV file

1. Setup

First, Create a folder inside of lib called seeds

Put your CSV file example.csv into the lib/seeds folder. In the example below, the file is called real_estate_transactions.csv

Make sure you've created a resource with the appropriate columns to match your seed data. The names don't have to match up.

module Denkgroot
include ActiveSupport::Configurable
config_accessor :title, :page_parts, :view_templates, :layout_parts, :custom_pages, :plugins, :structures
self.title = "denkGroot thema"
self.page_parts = [
{ name: 'text', title: 'Text', page_partable_type: "Spina::Text" },
{ name: 'teaser', title: 'Teaser', page_partable_type: "Spina::Line" },
def find_largest(numbers)
master_list = Array.new
list = numbers.permutation.to_a
list.map do |l|
master_list << l.join
end
master_list.sort.last
end
numbers = [1, 20, 3, 49, 442]
puts find_largest(numbers)
def while_loop(numbers)
i = 0
answer = 0
while i < (numbers.length)
answer += numbers[i]
i += 1
end
return answer
end
@karimmtarek
karimmtarek / ruby_interview_questions.md
Last active August 29, 2015 14:18
Interview_Questions_Ruby

#Ruby Interview Questions

What are blocks for?

Plain old english: Ways of grouping code we want to run. The simplest explanation for a block is that it is a chunk of code between {} or do...end, that can't be stored in a variable and isn't an object. A block is just part of the syntax of a method call. It doesn’t mean anything on a standalone basis and can only appear in argument lists.

What are the difference between p and puts?

The difference is subtle, but p prints the true value of an object, rather than a string-ified version of the object. This will make more sense soon, but for the sake of simplicity, we'll use the p command throughout the exercises, as we'll want to see the true values of our code returned to the output window.

@maxivak
maxivak / readme.md
Last active August 5, 2019 08:47
Install TinyMCE editor 4 with Elfinder file manager in Rails 4 app

TinyMCE with file manager

This post shows how to use TinyMCE 4.1 WYSIWYG text editor in a Rails 4 application for editing content in a textarea field.

TinyMCE is a powerful online WYSIWYG editor with many plugins.

If you want to insert an image by selecting it from images stored on server or upload an image to server, then you need to have a file manager with tinyMCE. TinyMCE comes with a file manager which is not free.

elFinder is an open-source file manager which can be easily integrated with tinyMCE 4.1.

@mihai-scurtu
mihai-scurtu / gist:4a488007cfd150f09a4d
Last active August 15, 2018 11:30
Integrating TinyMCE in an ember-cli app

Integrating TinyMCE in an ember-cli app

TinyMCE is a javascript WYSIWYG editor that is highly configurable and has a ton of features and plugins. It integrates with jQuery and, with a bit of work, it can be integrated in your ember-cli app.

Step 1: Install TinyMCE:

bower install --save tinymce

Step 2: Import the required files into your app via broccoli. In order to do that you will need a plugin called broccoli-static-compiler:

@gxespino
gxespino / ProgrammingManifesto.md
Last active February 4, 2021 01:01
Glenn's Path to Becoming a Ruby/Rails Programmer (Sept 2014 - Sept 2015)

#Programming Manifesto

##Books Ruby

  • Learn to Program by Chris Pine
  • The Well-Grounded Rubyist by David Black
  • Eloquent Ruby by Russ Olsen
  • Practical Object-Oriented Design in Ruby by Sandi Metz
  • Confident Ruby by Avdi Grimm