Skip to content

Instantly share code, notes, and snippets.

View amine2233's full-sized avatar

Amine Bensalah amine2233

View GitHub Profile
@amine2233
amine2233 / 0_reuse_code.js
Created January 1, 2014 19:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
public function autocomplete() {
$this->request->params['named']['filter'] = $this->request->data[$this->modelClass]['filter'];
if (!empty($this->request->params['named']['filter']) || $this->request->params['named']['filter'] !== '') {
$this->Prg->commonProcess();
$this->Paginator->settings = array(
'conditions' => $this->Location->parseCriteria($this->Prg->parsedParams()),
);
$this->set('locations', $this->Paginator->paginate());
}
$this->render('autocomplete', 'ajax');
@amine2233
amine2233 / init.lua
Last active February 18, 2017 23:15
My Hammerspoon
-- Hotkey mash
local mash = {"cmd", "alt", "ctrl"}
local mash_move = {"cmd", "ctrl"}
local mash_app = {"shift","ctrl","alt"}
hs.alert("Reloaded Config")
-- instant window resizing
hs.window.animationDuration = 0

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@amine2233
amine2233 / Bindings.swift
Created October 22, 2020 13:24 — forked from AliSoftware/Bindings.swift
Re-implementation of @binding and @State (from SwiftUI) myself to better understand it
/*:
This is a concept re-implementation of the @Binding and @State property wrappers from SwiftUI
The only purpose of this code is to implement those wrappers myself
just to understand how they work internally and why they are needed,
⚠️ This is not supposed to be a reference implementation nor cover all
subtleties of the real Binding and State types.
The only purpose of this playground is to show how re-implementing
them myself has helped me understand the whole thing better
ACTION = build
AD_HOC_CODE_SIGNING_ALLOWED = NO
ALTERNATE_GROUP = staff
ALTERNATE_MODE = u+w,go-w,a+rX
ALTERNATE_OWNER = grantdavis
ALWAYS_SEARCH_USER_PATHS = NO
ALWAYS_USE_SEPARATE_HEADERMAPS = YES
APPLE_INTERNAL_DEVELOPER_DIR = /AppleInternal/Developer
APPLE_INTERNAL_DIR = /AppleInternal
APPLE_INTERNAL_DOCUMENTATION_DIR = /AppleInternal/Documentation
@amine2233
amine2233 / introrx.md
Created April 5, 2021 07:59 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@amine2233
amine2233 / Calendar.swift
Created April 18, 2021 12:04 — forked from mecid/Calendar.swift
SwiftUI Calendar view using LazyVGrid
import SwiftUI
fileprivate extension DateFormatter {
static var month: DateFormatter {
let formatter = DateFormatter()
formatter.dateFormat = "MMMM"
return formatter
}
static var monthAndYear: DateFormatter {
@amine2233
amine2233 / .gitlab-ci.yml
Created August 25, 2021 12:45 — forked from kutzhanov/.gitlab-ci.yml
Deploy Docker container into AWS ECS Fargate using Gitlab CI
image: docker:19.03
variables:
REPOSITORY_URL: <AWS_ACCOUNT_ID>.dkr.ecr.<REGION_NAME>.amazonaws.com/<ECR_REPOSITORY_NAME>
REGION: <REGION_NAME>
TASK_DEFINITION_NAME: <TASK_DEFINITION_NAME>
CLUSTER_NAME: <CLUSTER_NAME>
SERVICE_NAME: <SERVICE_NAME>
CPU: <CPU>
MEMORY: <MEMORY>
@amine2233
amine2233 / assignNoRetain.swift
Created February 9, 2022 15:33 — forked from gdavis/assignNoRetain.swift
Combine assign method without the memory leak
extension Publisher where Self.Failure == Never {
public func assignNoRetain<Root>(to keyPath: ReferenceWritableKeyPath<Root, Self.Output>, on object: Root) -> AnyCancellable where Root: AnyObject {
sink { [weak object] (value) in
object?[keyPath: keyPath] = value
}
}
}