Skip to content

Instantly share code, notes, and snippets.

View rabidaudio's full-sized avatar

Julien (CJK) rabidaudio

View GitHub Profile
@rabidaudio
rabidaudio / Common.java
Last active August 29, 2015 14:02
Useful methods for Android
package com.rabidaudio;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import java.util.Iterator;
import java.util.Set;
@rabidaudio
rabidaudio / gist:0e358f7c6692b59b90b8
Created January 24, 2015 16:25
javascript capitalize first letter of every word
function capitalize(sentence){
sentence.split(" ").map(function(e){ var a = e.split(""); a.unshift(a.shift().toUpperCase()); return a.join(""); }).join(" ");
}
@rabidaudio
rabidaudio / gist:22ef920b682487f16ead
Created January 26, 2015 01:59
Slide-scroll on page with jQuery
(function($){
$.fn.scrollTo = function(maxTime, callback){
if(typeof maxTime === "function"){
callback = maxTime;
maxTime = 2000;
}else if(!maxTime){
maxTime = 2000;
}
if(!callback){
callback = new Function();
@rabidaudio
rabidaudio / gist:4ffdc2a81bd6811c608a
Created January 26, 2015 02:12
Round avatar icons
<style>
.avatar {
/* This is the size. TODO how to scale dynamically? */
width: 3em;
padding-bottom: 3em;
height: 0;
overflow: hidden;
border-radius: 9999px;
position: relative;
}
@rabidaudio
rabidaudio / ratings.scss
Created February 6, 2015 20:31
pure css ratings stars
/*
<span class="rating">
<span>Rating</span><br>
5<input type="radio" name="rating" id="rating_5" value="5" star="5"><label class="star" for="rating_5"></label>
4<input type="radio" name="rating" id="rating_4" value="4" star="4"><label class="star" for="rating_4"></label>
3<input type="radio" name="rating" id="rating_3" value="3" star="3"><label class="star" for="rating_3"></label>
2<input type="radio" name="rating" id="rating_2" value="2" star="2"><label class="star" for="rating_2"></label>
1<input type="radio" name="rating" id="rating_1" value="1" star="1"><label class="star" for="rating_1"></label>
</span>
*/
@rabidaudio
rabidaudio / gist:fa8efc798b3564fd5a75
Created February 22, 2015 00:09
Follow a page of people on twitter
$(".user-actions-follow-button").each(function(){ if($(this).css("background-color")==="rgb(245, 248, 250)") $(this).click() });
@rabidaudio
rabidaudio / gist:fa6849e4c1c91309e789
Created March 2, 2015 19:20
HTML alignment center lines
<div style="position: fixed; width:1px; left: 50%; top:0; bottom: 0; background-color: black;"></div>
<div style="position: fixed; height:1px; left: 0; top:50%; right: 0; background-color: black;"></div>
@rabidaudio
rabidaudio / LabelButton.js
Created March 12, 2015 08:09
MonkeyPatch Phaser game engine with a label button
//source: http://www.html5gamedevs.com/topic/2847-button-text/
var LabelButton = function(game, x, y, key, label, style, callback,
callbackContext, overFrame, outFrame, downFrame, upFrame)
{
Phaser.Button.call(this, game, x, y, key, callback,
callbackContext, overFrame, outFrame, downFrame, upFrame);
//Style how you wish...
@rabidaudio
rabidaudio / jquery.dragHighlight.js
Last active October 27, 2016 22:56
A little jQuery plugin for draggable selections, a la whenisgood.net
/**
* A simple little jQuery plugin for doing draggable selections (like http://whenisgood.net/).
* Maybe not super performant, but it's jQuery so you already don't care.
*
* Demo:
* http://jsfiddle.net/qa06oab2/
*
* Usage:
* $(<selector for elements>).dragHighlight(<optional name of class to add, defaults to 'selected'>);
*