Skip to content

Instantly share code, notes, and snippets.

View kro12's full-sized avatar
💭
Abiding 🍸

Cronin O' Mahoney kro12

💭
Abiding 🍸
View GitHub Profile
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@kurtmilam
kurtmilam / deep_extend_javascript_objects_underscore_mixin.js
Last active October 3, 2024 10:57
Deep Extend / Merge Javascript Objects - underscore.js Mixin
/* Copyright (C) 2012-2014 Kurt Milam - http://xioup.com | Source: https://gist.github.com/1868955
*
* This mixin now has its own github repository: https://github.com/kurtmilam/underscoreDeepExtend
* It's also available through npm and bower
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFR
@Slotos
Slotos / aa_globalize_hack.rb
Created March 26, 2012 11:53
ActiveAdmin Globalize form
module Formtastic
class FormBuilder
def globalize_inputs(*args, &proc)
index = options[:child_index] || "#{self.object.class.to_s}-#{self.object.object_id}"
linker = ActiveSupport::SafeBuffer.new
fields = ActiveSupport::SafeBuffer.new
::I18n.available_locales.each do |locale|
linker << self.template.content_tag(:li,
self.template.content_tag(:a,
::I18n.t('translation', :locale => locale),
@cgallagher
cgallagher / action.rb
Created May 3, 2012 11:45
Basic FB Action
class Fbaction < ActiveRecord::Base
class << self
def publish!(fbid)
url = url + "/#{entry.id}"
params = { "<object_ref_here>" => url,
:access_token => access_token
}
res = Bookface::Graph.request("#{fbid}/<namespace_here>:<action_name_here>", params, :method => :post)
end
@sebmarkbage
sebmarkbage / Enhance.js
Last active November 7, 2024 13:05
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {