Skip to content

Instantly share code, notes, and snippets.

View ahmad-moussawi's full-sized avatar
🎹
Playing 🎶

Ahmad Moussawi ahmad-moussawi

🎹
Playing 🎶
View GitHub Profile
@ahmad-moussawi
ahmad-moussawi / oracle_legacy_pagination.sql
Created January 5, 2019 07:49
Pagination in multiple databases
SELECT * FROM (
  SELECT "subquery".*, ROWNUM "row_num" FROM (
  SELECT "id", "name" from "Users"
  ) "subquery" WHERE ROWNUM <= 20
) WHERE "row_num" >= 10
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Reflection.Emit;
using System.Collections.Concurrent;
using System.Data;
using System.Reflection;
@ahmad-moussawi
ahmad-moussawi / $namedRoute.js
Created May 13, 2018 08:12 — forked from stakach/$namedRoute.js
Augments AngularJS $route provider with route naming.
(function(angular) {
'use strict';
/*
Usage:
-----
FILE --app.js--
@ahmad-moussawi
ahmad-moussawi / sign.sh
Created November 29, 2017 14:15 — forked from ezimuel/sign.sh
Sign and verify a file using OpenSSL command line tool. It exports the digital signature in Base64 format.
#!/bin/bash
# Sign a file with a private key using OpenSSL
# Encode the signature in Base64 format
#
# Usage: sign <file> <private_key>
#
# NOTE: to generate a public/private key use the following commands:
#
# openssl genrsa -aes128 -passout pass:<passphrase> -out private.pem 2048
# openssl rsa -in private.pem -passin pass:<passphrase> -pubout -out public.pem
@ahmad-moussawi
ahmad-moussawi / HomeController.cs
Created May 18, 2016 10:17
A view Render for Razor (aspnetcore RC2)
public class HomeController : Controller {
private readonly ViewRender view;
public HomeController (ViewRender view) {
this.view = view
}
public string Test () {
// render ~/Views/Emails/ResetCode
<?php
$i = 0;
$col = 5; // number of items per row
$width = 100/ $count;
$count = count($items)
?>
<div class="white-box gallery">
<?php foreach($items as $item): ?>
<?php if($i % $col === 0): ?>
@ahmad-moussawi
ahmad-moussawi / create_db_user.sql
Created April 4, 2015 06:47
SQL Server Create Login with User
-- create a user myUser with myPassword and assign it to myDb
USE [master]
GO
-- Delete existing login.
IF EXISTS (SELECT * FROM sys.server_principals WHERE name = N'myUser')
DROP LOGIN [myUser]
GO
@ahmad-moussawi
ahmad-moussawi / index.html
Created June 16, 2014 10:32
angular dropzone uploader
<div ng-show="!item.edit">
<div ng-if="item.row.logo" >
<img ng-src="uploads/mdpi/{{item.row.logo}}" style="max-width: 80px;"/>
</div>
<div ng-if="!item.row.logo"><i>No image selected</i></div>
</div>
<div class="dropzone">
Byblos API enhancements
=======================
## Version
The version of the API should be included in the base URL of the API precedeed with the letter v
e.g. `//myapi.com/v1/accounts`
## Naming
### Use names for resources and verbs for actions
Provide sensible **names** for the applications resources
<?php
class News extends Eloquent{
public function scopeLang($query)
{
return $query->where('LocalString.lang', LANG);
}