Skip to content

Instantly share code, notes, and snippets.

View Dreamersoul's full-sized avatar
🚀

Hamad AlGhanim Dreamersoul

🚀
View GitHub Profile
@hfossli
hfossli / Display.swift
Last active July 13, 2020 16:22
Display mode
import UIKit
public enum DisplayType {
case unknown
case iphone4
case iphone5
case iphone6
case iphone6plus
static let iphone7 = iphone6
static let iphone7plus = iphone6plus
@Humoud
Humoud / functions.swift
Created July 7, 2016 15:14
Here we demonstrate functions in Swift. Concentrating on three points: Pass-by-Value, Pass-by-Reference, and External Name / Internal Name.
// Here we demonstrate functions in swift
// Concentrating on three points:
// * Pass-by-Value
// * Pass-by-Reference
// * External Name / Internal Name
//
// Drop this in a playground to see instant results.
func combineStr(str1: String, str2: String) -> String {
@deepak786
deepak786 / InstagramLikeColorTransition.txt
Last active April 27, 2022 14:30
Instagram Like Gradient Color Transition in Android
/******This Gist explains how to create instagram like Gradient color transition in android.******/
1. Create some gradient color drawables inside drawable Folder.
a) color1.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#c44e4e"
android:endColor="#dcb9b9"
android:angle="0"/>
@Humoud
Humoud / facts_rules.pl
Created March 21, 2016 07:14
Some notes I gathered on Prolog. Consider this a mini intro to Prolog. Will improve this gist as I continue to learn Prolog.
/*
To run this:
open command prompt execute 'swipl'
then run ['path/to/this/file.pl'].
then query away.
*/
% FACTS
likes(jana, omar).
likes(omar, jana).
@Humoud
Humoud / docker.md
Last active March 30, 2016 13:41
Docker notes from this video: https://www.youtube.com/watch?v=qidknGXzvf0

Note: dm is an alias for docker-machine

List Machines

dm ls

Create Docker Machine

dm create -d virtualbox hello-world

View Machine's Env Vars

dm env hello-world

@chrisbanes
chrisbanes / CollapsingTitleLayout.java
Last active March 26, 2023 11:58
CollapsingTitleLayout
/*
* Copyright 2014 Chris Banes
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@sspross
sspross / 01_ubuntu.md
Last active December 14, 2015 16:20
Django Setup: Ubuntu 14.04, postgres, postgis, nginx, gunicorn, postfix, monit, redis, rabbitmq, celery, npm, gulp, pip wheel
passwd

apt-get update
apt-get upgrade

apt-get install fail2ban

useradd deploy

mkdir /home/deploy

@alexfu
alexfu / DividerItemDecoration.java
Last active February 9, 2023 05:09
An ItemDecoration that draws dividers between items. Pulled from Android support demos.
/*
* Copyright (C) 2014 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@dcwatson
dcwatson / range_streaming.py
Last active May 6, 2023 20:10
Django streaming view accepting byte range requests
from django.http import StreamingHttpResponse
from wsgiref.util import FileWrapper
import mimetypes
import os
import re
range_re = re.compile(r'bytes\s*=\s*(\d+)\s*-\s*(\d*)', re.I)
class RangeFileWrapper (object):
def __init__(self, filelike, blksize=8192, offset=0, length=None):