Skip to content

Instantly share code, notes, and snippets.

View Demwunz's full-sized avatar
:octocat:
donuts

Fazal Demwunz

:octocat:
donuts
View GitHub Profile
@qawemlilo
qawemlilo / grayscale.js
Created July 19, 2011 09:20
Edit images to grayscale using JavaScipt and HTML5 canvas.
function toGreyScale(r, g, b) {
return r * 0.2989 + g * 0.5870 + b * 0.1140;
}
function editImage(img, targetDiv) {
var id = "editeImage", canvasContainer = document.getElementById(targetDiv),
imgCanvas, ctx, imageData, px, len, i, redPx, greenPx, bluePx, greyscale;
imgCanvas = document.createElement("canvas");
imgCanvas.id = id;
@bzerangue
bzerangue / google-plus-one.xsl
Last active August 16, 2020 21:52
[XSLT] Google +1 XSL Utility
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:g="http://schemas.google.com/g/2005"
exclude-result-prefixes="g">
<!--
Name: Google +1 Utility
Version: 1.0.1
Author: Brian Zerangue <brian.zerangue@gmail.com>
@bzerangue
bzerangue / twitter-button.xsl
Created August 31, 2011 17:21
[XSLT] Twitter Button XSL Utility
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Twitter Button: XSL Utility
Created by Zerangue, Brian on 2011-08-31.
Copyright (c) 2011 Brian Zerangue. All rights reserved.
-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@scottwater
scottwater / curl
Last active February 15, 2021 04:07
Quick KickoffLabs API
curl -d 'email=scott@kickofflabs.com&api_key=your_api_key' https://api.kickofflabs.com/v1/1905/subscribe
curl -G -d "email=scott@kickofflabs.com" https://api.kickofflabs.com/v1/1905/info
@bartoszmajsak
bartoszmajsak / prepare-commit-msg.sh
Last active March 20, 2024 08:12
How to automatically prepend git commit with a branch name
#!/bin/bash
# This way you can customize which branches should be skipped when
# prepending commit message.
if [ -z "$BRANCHES_TO_SKIP" ]; then
BRANCHES_TO_SKIP=(master develop test)
fi
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME="${BRANCH_NAME##*/}"
@chriseppstein
chriseppstein / 0_silent_selector_grid.scss
Created January 4, 2012 22:08
This gist describes a new feature we're experimenting with for Sass 3.2: placeholder selectors. They do not get generated into your output, but they can be used like a class and extended like one.
$gutter: 10px;
$grid-unit: 60px;
%clearfix {
*zoom: 1;
&:after {
content: "\0020";
display: block;
height: 0;
clear: both;
@jaysonrowe
jaysonrowe / FizzBuzz.py
Created January 11, 2012 03:05
FizzBuzz Python Solution
def fizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)
@oodavid
oodavid / README.md
Last active April 6, 2024 18:45 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@dieseltravis
dieseltravis / gist:2039843
Created March 14, 2012 21:56
progressive image loading
/*
HTML: (white-space and quotes in data attribute is important)
<noscript data-image='{ "large": { "src": "http://placehold.it/640x480", "width": "640", "height": "480", "highdpisrc": "http://placehold.it/1280x960" }, "small": { "src": "http://placehold.it/320x240", "width": "320", "height": "240", "highdpisrc": "http://placehold.it/640x480" }, "alt": "test image" }'>
<img src='http://placehold.it/160x120' width='160' height='120' alt='test image' />
</noscript>
*/
$(function () {
var selectedImage = ( $(window).width() >= 500 ) ? "large" : "small",
selectedSrc = ( window.devicePixelRatio >= 2 ) ? "highdpisrc" : "src";
@LeZuse
LeZuse / Javascript-base.sublime-snippet
Last active March 20, 2023 16:52
Sublime Text Javascript snippets
<snippet>
<content><![CDATA[base(this, '${1:method}'${2});${0}]]></content>
<tabTrigger>base</tabTrigger>
<scope>source.js</scope>
<description>Base method call</description>
</snippet>