Skip to content

Instantly share code, notes, and snippets.

Avatar

Ibrahim Muhammad whistler

View GitHub Profile
@whistler
whistler / console.js
Last active Aug 29, 2015
Access Angular service from console
View console.js
service = angular.element('*[ng-app]').injector().get('serviceName')
@whistler
whistler / canvas_image.js
Created Oct 17, 2014
Add Image to Canvas
View canvas_image.js
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;
View backspace.py
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 Aug 29, 2015
this in if
View this.js
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 Aug 12, 2011
Center a Fixed Width Div
View center-div.css
div#main {
width: 750px;
margin-left: auto;
margin-right: auto
}
@whistler
whistler / image-caption.css
Created Aug 12, 2011
Create Onhover Image Caption Using CSS
View image-caption.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 Aug 12, 2011
Opacize on mouseover CSS
View mouseover-opacity.css
.transparent
{zoom: 1;
filter: alpha(opacity=70);
opacity: 0.7;
}
.transparent:hover
{
opacity:1;
-moz-opacity:1;
@whistler
whistler / monochrome-image.css
Created Aug 12, 2011
Monochrome image with CSS
View monochrome-image.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 Aug 12, 2011
Align a div to the center of another div
View div-align-center.css
.inner {
width: 50%;
margin: auto;
}
@whistler
whistler / deploy.rb
Created Aug 13, 2011 — forked from skojin/deploy.rb
base capistrano configuration for passenger
View deploy.rb
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"
You can’t perform that action at this time.