Skip to content

Instantly share code, notes, and snippets.

View falnatsheh's full-sized avatar

Feras Alnatsheh falnatsheh

View GitHub Profile
@jgable
jgable / JsonService.cs
Created March 22, 2011 17:49
A basic JsonService using WebClient and DataContractJsonSerializer for Windows Phone 7, along with an example of how to use it.
using System;
using System.IO;
using System.Net;
using System.Runtime.Serialization.Json;
using System.Text;
/// <summary>
/// Strongly typed GET and POST utility enum.
/// </summary>
public enum HTTPMethod
@pamelafox
pamelafox / tumlbr_template.html
Created April 12, 2012 19:07
Twitter Bootstrap Tumblr Theme
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml" xmlns:og="http://ogp.me/ns#"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name='description' content='{MetaDescription}'>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@kdbdallas
kdbdallas / Photoshop Colorize
Last active September 27, 2019 13:57
What Photoshop's Colorize option in the Hue/Saturation adjustment window does
The Colorize option changes the nature of the Hue/Saturation control.
When checked, it removes the color from an image and overlays the image with a tint of a single hue and saturation.
Each pixel's luminosity remains unchanged (actually, it is changed, but very little).
With the Colorize option, the Hue and Saturation values are no longer relative numbers based on an offset from a starting point.
Instead, they are absolute numbers.
The Hue value ranges from 0° to 360° and represents an absolute position on the color wheel (0° and 360° are the same color; red)
The Saturation value ranges from 0% to 100%.
If Saturation is changed to 0%, color will be negated and the pixels will go gray.
Using Hue/Saturation to colorize an image is not the same as making a duo tone.
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@zef
zef / gist:10904278
Created April 16, 2014 16:37
Was messing with replacing color in an image with another color. Didn't work that well, mostly saturation and brightness problems
- (UIImage *)imageByShiftingFromColor:(UIColor *)startColor toColor:(UIColor *)endColor
{
CGFloat startHue, startSaturation, startBrightness, startAlpha;
BOOL parsedStartColor = [startColor getHue:&startHue saturation:&startSaturation brightness:&startBrightness alpha:&startAlpha];
NSLog(@"start success: %i hue: %0.2f, saturation: %0.2f, brightness: %0.2f, alpha: %0.2f", parsedStartColor, startHue, startSaturation, startBrightness, startAlpha);
CGFloat endHue, endSaturation, endBrightness, endAlpha;
BOOL parsedEndColor = [endColor getHue:&endHue saturation:&endSaturation brightness:&endBrightness alpha:&endAlpha];
NSLog(@"end success: %i hue: %0.2f, saturation: %0.2f, brightness: %0.2f, alpha: %0.2f", parsedEndColor, endHue, endSaturation, endBrightness, endAlpha);
@mbigatti
mbigatti / UIColor+RGB.swift
Last active February 14, 2021 07:22
UIColor extension that add a whole bunch of utility functions.
//
// UIColor+RGB.swift
// Copyright (c) 2014 Massimiliano Bigatti. All rights reserved.
//
import Foundation
import UIKit
/**
UIColor extension that add a whole bunch of utility functions like:
@justasm
justasm / MaskImageView.java
Created September 1, 2014 17:14
Android image compositing - masking Bitmap with another Bitmap.
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.util.AttributeSet;
import android.widget.ImageView;
@filipbec
filipbec / gist:5998034874b119fab0e4
Created September 5, 2014 12:31
Scannr - Keys for obtaining US Driver's license data
@alexruperez
alexruperez / UIImageTintCGExtension.swift
Last active March 2, 2021 13:54
UIImage tint with UIColor in Swift
extension UIImage
{
func tint(color: UIColor, blendMode: CGBlendMode) -> UIImage
{
let drawRect = CGRectMake(0.0, 0.0, size.width, size.height)
UIGraphicsBeginImageContextWithOptions(size, false, scale)
let context = UIGraphicsGetCurrentContext()
CGContextClipToMask(context, drawRect, CGImage)
color.setFill()
UIRectFill(drawRect)