Skip to content

Instantly share code, notes, and snippets.

View Osmose's full-sized avatar

Osmose Osmose

View GitHub Profile
@Osmose
Osmose / gist:2664ed7e919e91a29909
Last active August 29, 2015 14:00
HTML5 Piano + Recording Mod
// http://bits.potch.me/piano.html
// Copy and paste into console, start playing via keyboard.
// Then, press Z to play back your music!
// Playback deletes recorded music.
var log = [];
var sinceLast = null;
document.body.addEventListener('keydown', function(e) {
if (e.keyCode == 90) {
playBack();
} else {

Keybase proof

I hereby claim:

  • I am osmose on github.
  • I am osmose (https://keybase.io/osmose) on keybase.
  • I have a public key whose fingerprint is 41E2 93A3 4AC9 F05C ABF8 D5C2 780C E613 F8E1 024D

To claim this, I am signing this object:

We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 6.
id,entity_id,locale_id,"string","date",user_id,approved,plural_form,fuzzy,approved_user_id,"approved_date"
46,52,111,"Il nostro team dedicato al supporto è sempre disponibile per aiutarti con qualunque domanda su Firefox.&nbsp;<a>Ulteriori informazioni</a>.","2014-01-15 04:50:04",NULL,0,NULL,0,NULL,NULL
47,53,111,"Se hai bisogno di aiuto, <a>visita Mozilla Support</a>. Se invece sei un utente esperto di Firefox, <a>diventa un volontario</a> e aiutaci a rispondere o scrivere articoli.","2014-04-11 12:46:53",NULL,0,NULL,0,NULL,NULL
48,50,111,"La nuova schermata principale di Firefox per Android ti permette di navigare sul Web più velocemente. <a>Installa oggi stesso Firefox per Android.</a><br>","2014-01-15 04:50:04",NULL,0,NULL,0,NULL,NULL
49,51,111,"Personalizza Firefox con la bandiera della tua nazione e celebra lo spirito globale della comunità.","2014-04-11 12:46:53",NULL,0,NULL,0,NULL,NULL
55,50,85,"Mit dem neuen Firefox-Startbildschirm auf Android können Sie sich schnell durch das Internet bewegen. &lt;a

CSS bounce effect on hover for long filenames in a music player.

Preview

<h2 className="name">
    <span className="info-line-wrapper">
        <span className="info-line">
            Some long audio filename
        </span>
def someMethod(blah)
# Do some stuff
if somecondition
var1
else
var2
end
end
# Does this perform a single query with the filters or does it perform the first part and filter within Ruby after?
Zombie.where(:type => "Left 4 Dead").order(:name).limit(2)
# Class for a table called "zombies" in MySQL with some columns
class Zombie < ActiveRecord::Base
validates_presence_of :name #name column must exist before saving to DB
validates_uniqueness_of :name #names must be unique
has_many :weapons #The weapons table will have a column describing ownership by zombies
end
# Class for "weapons" table
class Weapon < ActiveRecord::Base
belongs_to :zombie #Other half of ownership, column will be called "zombie_id"
def somemethod
# do stuff!
if somecondition
value
elsif another_condition
somethingelse
else
anothervalue
end
end
# Renders "tags/form" with the @form instance variable defined
<%= render :partial => 'tags/form',
:locals => {:form => post_form} %>
# Renders "customer"; the value in :object is defined as a local variable customer in the partial
<%= render :partial => "customer", :object => @new_customer %>
#include "mpi.h"
#include <stdio.h>
#include <math.h>
int main( int argc, char *argv[])
{
int n, i, k;
double PI25DT = 3.141592653589793238462643;
double pi, h, sum, x, recv_sum;