Skip to content

Instantly share code, notes, and snippets.

View samueljseay's full-sized avatar
😘

Sam Seay samueljseay

😘
View GitHub Profile
@millermedeiros
millermedeiros / image.js
Created February 10, 2011 22:19
RequireJS Image Plugin
/*
* Example #1 : usage example
* - Image paths are relative to the HTML file.
* - Support absolute paths as well.
* - Appending `!bust` to the end of the file name will avoid caching the image.
*/
require(['image!lol_cat.gif', 'image!http://tinyurl.com/4ge98jz', 'image!dynamic_image.jpg!bust'], function(cat, awesome, dynamic){
//add loaded images to the document!
document.body.appendChild(awesome);
document.body.appendChild(cat);
@beccasaurus
beccasaurus / README.markdown
Created May 5, 2011 19:37
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can:

@domenic
domenic / di-in-requirejs.js
Created October 10, 2011 04:05
Dependency injection sample with RequireJS
// EntryPoint.js
define(function () {
return function EntryPoint(model1, model2) {
// stuff
};
});
// Model1.js
define(function () {
return function Model1() {
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

-# HTML5 doctype
!!! 5
!!! strict
!!! XML
%html
-#ie conditionals
/[if IE]
%a{ href: "http://www.mozilla.com/en-US/firefox/" }
@mprymek
mprymek / gist:8379066
Last active July 22, 2022 09:18
Elixir metaprogramming example
# This is an example of metaprogramming in the Elixir language.
#
# We will define a domain specific language (DSL) for the definition
# of a service which is watched by several sensors.
# Each sensor watches some property/functionality of the service and
# returns the result of the check.
#
# To determine if the service is functioning properly, we need functions
# to run all the sensors' code and gather the returned data.
#
@jensgro
jensgro / enterprise-link.html
Last active February 10, 2019 15:30
Enterprise-Code from hell
@wenzhixin
wenzhixin / ubuntu14.04-command-line-install-android-sdk
Last active January 16, 2024 21:15
Ubuntu 14.04 command line install android sdk
# install openjdk
sudo apt-get install openjdk-7-jdk
# download android sdk
wget http://dl.google.com/android/android-sdk_r24.2-linux.tgz
tar -xvf android-sdk_r24.2-linux.tgz
cd android-sdk-linux/tools
# install all sdk packages
@lopspower
lopspower / README.md
Last active April 26, 2024 07:55
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@dpmedeiros
dpmedeiros / AndroidMockUtil.java
Last active January 28, 2021 06:26
Mock main thread handler for use in Android unit tests (requires Mockito and PowerMock)
package com.dpmedeiros.androidtestsupportlibrary;
import android.os.Handler;
import android.os.Looper;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import org.powermock.api.mockito.PowerMockito;
import java.util.concurrent.Executors;