Skip to content

Instantly share code, notes, and snippets.

Samir Sabri hopewise

Block or report user

Report or block hopewise

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hopewise
hopewise / build.gradle
Created Jun 24, 2019
Build gradle without signing info to be used with MS App Center
View build.gradle
repositories {
maven { url 'https://raw.github.com/applanga/sdk-android/master/maven/releases/' }
maven { url 'https://jitpack.io' }
}
buildscript {
repositories {
jcenter()
google()
maven {
@hopewise
hopewise / gist:0ac6a48b3502a42554ca5ba61dd258df
Created Mar 25, 2019
Extract all screen titles in sketch.cloud
View gist:0ac6a48b3502a42554ca5ba61dd258df
#might need to change selector..
for (var i=0; i< $$(".sc-gacfCG").length; i++) console.log(i, $$(".sc-gacfCG")[i].textContent);
@hopewise
hopewise / copy_folder.rb
Created Feb 27, 2019
ruby method to copy from a folder to another folder within the same bucket
View copy_folder.rb
tested with `gem 'aws-sdk', '~> 2'`
```
@s3 = Aws::S3::Client.new(
region: ENV['AWS_REGION'],
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_KEY']
)
@hopewise
hopewise / gist:59c8e48f73484a1c85f24a58ab78fb9a
Created Jul 5, 2018
Manual installation for module in Odoo
View gist:59c8e48f73484a1c85f24a58ab78fb9a
#start odoo container for the first time
docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.4
docker run -p 8069:8069 -it --name odoo --link db:db -t odoo
#bash into odoo as root
docker exec -i -t -u 0 odoo /bin/bash
#download module and extract it at local file system
#copy module to odoo modules directory
View gist:82f4c26868e52a5c3a3b4053400609a9
docker run -p 4011:4011 -p 4033:4033 -v /Users/samir/Documents/projects/elixir:/usr/src -it elixir:1.5.2 bash
@hopewise
hopewise / .babelrc
Last active Aug 16, 2018
React JS , mobx , GraphQL , apollo client, webpack-dev-server writes file to desk, load .graphql files separately
View .babelrc
{
"presets": [
"react",
"es2015",
"stage-1"
],
"plugins": ["transform-decorators-legacy", "transform-class-properties", "inline-import-graphql-ast"]
}
@hopewise
hopewise / gist:7bfdd80e9e9a0e2fe4ea95866fec3a0c
Last active May 28, 2018
force python3 in terminal, this is important to make sure AWS eb deploy uses git to deploy
View gist:7bfdd80e9e9a0e2fe4ea95866fec3a0c
#to let eb use python3
export PATH=/Users/Apple/Library/Python/3.4/bin:$PATH
@hopewise
hopewise / gist:b37df5c8a884babf9f9e5760cdedaa11
Created Jan 22, 2018
Piping (|>) to second argument in Elixir
View gist:b37df5c8a884babf9f9e5760cdedaa11
insert_result = result
|> FieldsFitter.fit_driver_fields
|> (&Schools.Driver.changeset(%Schools.Driver{}, &1)).()
|> repo.insert
@hopewise
hopewise / gist:391d854732c2c144c9671a7e9bc79d0b
Created Jan 10, 2018
Json encoding Ecto changeset validation errors
View gist:391d854732c2c144c9671a7e9bc79d0b
for result_error <- changeset.errors do
{field_name, ecto_error}= result_error
{error_message, ecto_validation}= ecto_error
[ecto_validation_message| ecto_validation_tail] = ecto_validation
ecto_validation_message= Kernel.inspect ecto_validation_message
Poison.encode! %{error: "invalid field value", field: %{field_name: field_name, error_message: ecto_validation_message }})
end
@hopewise
hopewise / gist:0373922e51e313a55390114908c31257
Created Dec 12, 2017
Convert a key => value map into a sorted list based on values, works with value if string
View gist:0373922e51e313a55390114908c31257
Enum.map(Enum.to_list(0..Enum.count(Map.keys(row))), fn index -> row["#{index}"] end)
example row:
row %{"0" => "2", "1" => "أحمد عمر فؤاد خالد عبدالله 2",
"10" => "null", "11" => "null", "12" => "null", "13" => "null",
"14" => "null", "2" => "Male", "3" => "الأول الأساسي", "4" => "A",
"5" => "Amman", "6" => "null", "7" => "null", "8" => "null", "9" => "null"}
You can’t perform that action at this time.