Skip to content

Instantly share code, notes, and snippets.

View louy's full-sized avatar
💭
I may be slow to respond.

Louay Akkad louy

💭
I may be slow to respond.
View GitHub Profile
@louy
louy / ko.subscribable.subscribechanged.js
Created July 10, 2014 02:45
Subscribe with Old and New Value for Knockout Subscribable
ko.subscribable.fn.subscribeChanged = function( callback ) {
var oldValue;
return [
this.subscribe( function( _oldValue ) {
oldValue = _oldValue;
}, this, 'beforeChange' ),
this.subscribe( function( newValue ) {
callback( newValue, oldValue );
} )
];
/**
* Fix element positioning when using adminbar
*/
@mixin fixed-top( $space, $property: "top", $factor: 1 ) {
#{$property}: $space * $factor;
.admin-bar & {
#{$property}: ($space + 46px) * $factor;
@media (min-width: 783px) {
#{$property}: ($space + 32px) * $factor;
}
@louy
louy / git-pull-all.sh
Created July 20, 2015 10:33
git pull-all
#!/bin/sh
find $PWD -type d -name .git \
| xargs -n 1 dirname \
| sort \
| while read line; do echo $line && cd $line && git pull; done
#!/bin/sh
# http://stackoverflow.com/a/2179876/1644422
for FILE in $(git ls-files)
do
TIME=$(git log --pretty=format:%cd -n 1 --date=iso $FILE)
TIME=$(date -j -f '%Y-%m-%d %H:%M:%S %z' "$TIME" +%Y%m%d%H%M.%S)
touch -m -t $TIME $FILE
done
@louy
louy / nginx.conf
Created April 28, 2016 21:23
Docker Nginx Config
daemon off;
user nginx;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
#!/bin/sh
set -e
git branch | grep -v "master" | xargs git branch -d
git fetch origin --prune

Keybase proof

I hereby claim:

  • I am louy on github.
  • I am louay (https://keybase.io/louay) on keybase.
  • I have a public key ASBtmGtwrtSjxZxz-xcoWXvlt2aQt_RP7QT7QbdYobGkzwo

To claim this, I am signing this object:

@louy
louy / aws-mfa.sh
Last active August 19, 2019 13:39
aws-cli mfa session utility
# AWS MFA session util
# Setup:
# assuming you're using a profile called "default":
# In ~/.aws/config, set up a default-mfa-temp profile:
# ```
# [default]
# region = eu-west-2
# [default-mfa-temp]
# region = eu-west-2
@louy
louy / index.html
Created December 18, 2018 19:51
React prototype boilerplate
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Prototype</title>
</head>
<body>
<div id="root"></div>
<script src="https://unpkg.com/react@16.7.0-alpha.2/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16.7.0-alpha.2/umd/react-dom.production.min.js"></script>
@louy
louy / AccessibilityWrapper.tsx
Last active November 30, 2023 10:23
RN Accessibility Wrapper, a custom view that allows you to control the accessibility behaviour of a React Native component tree
/**
* @author Louay Alakkad (github.com/louy)
* @license MIT https://opensource.org/licenses/MIT
*/
import React from 'react'
import PropTypes from 'prop-types'
import {
NativeModules,
ViewProps,
ViewPropTypes,