Skip to content

Instantly share code, notes, and snippets.

View gdakram's full-sized avatar
😺

Shahrier Akram gdakram

😺
  • Slytrunk
  • Pacifica, CA
View GitHub Profile
@gdakram
gdakram / skin_override_globally.html
Created September 14, 2012 18:01
Disable loader from fetching a skinnable module's assets from YUI's CDN, while on HTTPS.
<script>
var YUI_config = {
skin : {
overrides : {
"widget" : []
}
}
};
</script>
@gdakram
gdakram / yui-widget-structure.js
Created January 21, 2012 01:48 — forked from kara-ryli/yui-widget-structure.js
Basic YUI Widget Structure, commented up to work with yuidocs.
/* global YUI */
/**
* My Module's purpose
* @module my-module
* @requires base-build, widget
*/
YUI.add("my-module", function (Y) {
"use strict";
@gdakram
gdakram / gist:1300136
Created October 20, 2011 00:58
sports-in-motion-hack.js
javascript:(function(){
var images = document.getElementsByTagName("img");
var id_regex = new RegExp(/^thumb-img\d+/i);
var image_source_regex = new RegExp(/(.+?)t(.\w{3})$/);
var image_sources = [];
for (var i = 0; i < images.length; i++) {
if (id_regex.test(images[i].id) && image_source_regex.test(images[i].src)) {
image_source = RegExp.$1 + RegExp.$2;
image_sources.push(image_source);
}
@gdakram
gdakram / absolutize.js
Created July 28, 2011 15:15
Absolutize Image Src Paths for Images in Student Services Sites
// Fixing cascade resources
(function($){
// Fixing cascade resources
$.fn.absolutizePath = function(prefix, base_path) {
this.each(function() {
// No need to rewrite src or links if already inside ccp
if (/\/ccp\//.test(window.location.href)) {
return;
}
@gdakram
gdakram / carousel.html
Created July 6, 2011 16:52
cross-domain carousel rendering. source from the staging server.
@gdakram
gdakram / Rails 2 Environment
Created May 16, 2011 17:58 — forked from laserlemon/Rails 2 Environment
Snow Leopard -- RVM, Homebrew, Git, Imagemagick
# Installs on Snow Leopard.
# Homebrew
ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)"
echo 'export PATH=/usr/local/bin:/usr/local/sbin:$PATH' >> ~/.bash_profile
# Close Terminal window.
# Git
brew install git
brew update
@gdakram
gdakram / tic-tac-toe.rb
Created February 2, 2011 16:54
The game in ruby via cli. Have fun.
# the anatomy of a slot
Slot = Struct.new(:row, :column, :value)
# The board has n x n slots
class Board
# Constants
X = "X"
O = "O"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>3rd party website using the bookmarking widget</title>
</head>
<body>
....content....
<!-- Embed the script tag to make the widget show here -->
<script src="http://bookmarking-site.com/javascripts/widget.js"></script>
@gdakram
gdakram / academia-edu.js
Created January 14, 2011 22:06
challenge
<a href="#" class="save_to_academia_bookmarks">Save to Academia Bookmarks</a>
<script type="text/javascript">
window.Academia = window.Academia || {};
(function(a){
// the load event handler for the iframe
a.iframe_loaded = function(e) { console.log(e); }
// the click event handler for
a.a_links = document.getElementsByClassName("save_to_academia_bookmarks");
for (i = 0; i < a.a_links.length; i++) {
<script type="text/javascript">
//--<![CDATA[
$j(document).ready(function(){
var qaws_data = { social_commitment_level : 1, social_commitment_id : 1 };
var citizen_id = CookieManager.read("QaAuth_QaCookie").replace(/_\d+/,"");
$j.ajax({
url : "/qaws/set_social_commitment_level/"+citizen_id,
type : "POST",
dataType : "script",
data : $j.param(qaws_data)