Skip to content

Instantly share code, notes, and snippets.

View Asherlc's full-sized avatar

Asher Cohen (Editors) Asherlc

View GitHub Profile
this
<script type="text/javascript">
$(document).ready(function() {
$.extend({
getUrlVars: function() {
var vars = [],
hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
@Asherlc
Asherlc / test
Created October 15, 2012 23:15
test
test
@Asherlc
Asherlc / sample_json
Created October 15, 2012 23:18
Sample Image JSON
[
{
name: "Pointy.gif",
size: 1954,
url: "https://vocalem.s3.amazonaws.com/uploads/asset/asset/1/Pointy.gif",
delete_url: "/assets/1",
delete_type: "DELETE"
},
{
name: "Woof.gif",
@Asherlc
Asherlc / gist:5060018
Created February 28, 2013 20:51
User scoping with friendly_id
class Page < ActiveRecord::Base
extend FriendlyId
friendly_id :slug
validates :slug, :presence => true
validates_uniqueness_of :slug, :scope => :organization_id
end
<script>
$(document).ready(function() {
$("#calc").submit(function(e) {
e.preventDefault()
var p = $("#nocommas").val()
var years = $("#years").val()
var noCommas = p.replace(',', '');
var oldAmountOwed = amoritize(noCommas, years, .034)
{
"question": "I am a new question. What is love?"
}
resources :providers do
member do
put :refresh
end
end
// This function creates an <iframe> (and YouTube player)
// after the API code downloads.
<div id="player-div"></div>
var player;
player = new YT.Player('player-div', {
height: //Height
width: //Width
videoId: //YouTube UID
wmode: 'opaque', //Forget what this does but I think it's important. Otherwise the modal will be covered up.
autohide: 1,
import Ember from 'ember';
export default Ember.TextField.extend({
_value: null,
value: Ember.computed('_value', {
get() {
const value = this.get('_value');
if (value) {
return moment(value).format('L HH:mm');