Skip to content

Instantly share code, notes, and snippets.

componentDidMount = () => {
const rectangle = new google.maps.Rectangle({
...this.props.options,
map: this.context
})
this.setState({ rectangle }, () => {
this.registeredEvents = applyUpdatesAndRegisterEvents({
updaterMap,
eventMap,
@uriklar
uriklar / config.yml
Created June 20, 2018 13:56
Phytech CircleCI config file example
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:8.11
version: 2
jobs:
checkout_code:
<<: *defaults
steps:
@uriklar
uriklar / cors_configuration.xml
Last active June 22, 2018 13:53
S3 bucket cors configuration
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
<!-- You can also use * to allow request from any origin -->
<AllowedOrigin>YOUR APP's URL</AllowedOrigin>
<AllowedMethod>GET</AllowedMethod>
<MaxAgeSeconds>3000</MaxAgeSeconds>
<!-- Autorization header if your using some kind of user authentication that uses it -->
<AllowedHeader>Authorization</AllowedHeader>
<!-- Content-Length header required for serving gzip using CloudFront -->
@uriklar
uriklar / bucket_policy.json
Last active June 20, 2018 12:12
S3 bucket policy
{
"Version": "2008-10-17",
"Statement": [
{
"Sid": "Allow Public Access to All Objects",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
@uriklar
uriklar / instructions.txt
Last active December 29, 2017 16:41
Hub Eilat Web Course - Lesson 3 - Home assignment
1. Create the PostsController using the command: rails g controller Posts
2. Copy the attached file posts_controller_test.rb and paste it into test/controllers/posts_controller_test.rb
3. run tests using the command: rake test TEST=./test/controllers/posts_controller_test.rb
הקונטרולר שלכם צריך להכיל 5 פונקציות (יכולים להעזר בדוגמא המצורפת users_controller.rb)
index:
מקבלת כפרמטרים:
params[:user_id] - האיי די של היוזר שאת הפוסטים שלו אנחנו רוצים לקבל
מחזירה:
את כל הפוסטים של היוזר הזה
@uriklar
uriklar / Creating fakebook app
Last active December 25, 2017 06:44
Create fakebook app with models
From your root folder (C:\Sites ?), write the following commands:
rails new fakebook (Creates the fakebook app)
cd fakebook (Enters the fakebook folder)
rails g model User first_name last_name email password (Creates the User model file + migration to create users table)
rake db:migrate (Runs the migration and creates the users table)
rails g model Post text user_id:integer (Creates the Post model + migration to create posts table)
@uriklar
uriklar / fix_user_fields.rb
Created December 19, 2017 19:44
Rename columns migration
class FixUserFields < ActiveRecord::Migration
def change
rename_column :users, :First_name, :first_name
rename_column :users, :Last_name, :last_name
rename_column :users, :Email, :email
rename_column :users, :Password, :password
end
end
@uriklar
uriklar / recursively-flatten.js
Created August 22, 2017 13:42
Function that recursively flattens an array in vanilla JS with tests
function recursivelyFlatten(array) {
if (!array) {
return []
}
var result = [];
if (Array.isArray(array)) {
array.forEach((value) => {
result = result.concat(recursivelyFlatten(value));