Skip to content

Instantly share code, notes, and snippets.

View whistler's full-sized avatar

Ibrahim Muhammad whistler

View GitHub Profile
@whistler
whistler / console.js
Last active August 29, 2015 13:57
Access Angular service from console
service = angular.element('*[ng-app]').injector().get('serviceName')
@whistler
whistler / canvas_image.js
Created October 17, 2014 16:33
Add Image to Canvas
window.onload = function ()
{
var canvas = document.getElementById("overlay_canvas");
var ctx = canvas.getContext("2d");
var image = new Image();
image.src = "http://placekitten.com/4536/3024";
image.onload = function () {
ctx.drawImage(image, 0, 0);
image_ctx = image.getContext("2d");
debugger;
@whistler
whistler / backspace.py
Created March 26, 2015 00:31
Backspace Test
import sys
import time
for i in range(10):
print '\r', # print is Ok, and comma is needed.
time.sleep(0.3)
print i,
sys.stdout.flush() # flush is needed.
@whistler
whistler / this.js
Last active August 29, 2015 14:23
this in if
var AnimalView = Backbone.View.extend({
..
save: function() {
var that = this;
if(!this.isSaved) {
that.model.save()
} else {
that.alreadySaved();
}
},
@whistler
whistler / center-div.css
Created August 12, 2011 19:55
Center a Fixed Width Div
div#main {
width: 750px;
margin-left: auto;
margin-right: auto
}
@whistler
whistler / image-caption.css
Created August 12, 2011 20:03
Create Onhover Image Caption Using CSS
/* parent div and hover properties */
.imgteaser {
margin: 0;
overflow: hidden;
float: left;
position: relative;
}
.imgteaser a {
text-decoration: none;
float: left;
@whistler
whistler / mouseover-opacity.css
Created August 12, 2011 20:08
Opacize on mouseover CSS
.transparent
{zoom: 1;
filter: alpha(opacity=70);
opacity: 0.7;
}
.transparent:hover
{
opacity:1;
-moz-opacity:1;
@whistler
whistler / monochrome-image.css
Created August 12, 2011 20:05
Monochrome image with CSS
a.a-thumb {
border: 1px solid black;
position: relative;
}
a.a-thumb img {
width: 60px;
height: 60px;
border: 0;
}
@whistler
whistler / div-align-center.css
Created August 12, 2011 20:30
Align a div to the center of another div
.inner {
width: 50%;
margin: auto;
}
@whistler
whistler / deploy.rb
Created August 13, 2011 09:04 — forked from skojin/deploy.rb
base capistrano configuration for passenger
set :application, "appname"
set :domain, "domain.tld"
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
set :repository, "." # Deploy from the local repository
set :scm, "git"
set :branch, "master"