Skip to content

Instantly share code, notes, and snippets.

@Neener54
Neener54 / editor.js
Created April 2, 2012 17:06
handlebars template
wysiwyg = {
wysihtml5 : function(){
// Global array of editor instances, necessary for being able to do custom functions later
editors = new Array();
$('textarea.wysihtml5').each(function(){
var currTextArea = $(this);
var currId = currTextArea.attr('id');
wysiwyg.toolbar(currTextArea);
editors[currId] = new wysihtml5.Editor(currId.toString(), {
name: 'wysihtml5_ed_'+currId,
class SearchController < ApplicationController
# ACL
filter_access_to :all
def index
@search_params={}
@search_params[:content_types] = [params[:content_type]]
@search_params[:titles] = [params[:title]]
@search_params[:authors] = [params[:author]]
@search_params[:keywords] = [params[:keywords]]
@Neener54
Neener54 / install_ruby.sh
Last active October 10, 2015 05:57
Custom Version of Rails Girls with rvm and what not
set -e
echo "Updates packages. Asks for your password."
sudo apt-get update -y
echo "Installs packages. Give your password when asked."
sudo apt-get install build-essential bison openssl libmagic-dev libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 mysql-client mysql-server libmysql-ruby libmysqlclient-dev libxml2-dev libxslt-dev autoconf libc6-dev nodejs -y
echo "Installs ImageMagick for image processing"
sudo apt-get install imagemagick --fix-missing -y
@Neener54
Neener54 / image_size.js
Created September 6, 2012 15:07
Get image height before writing to the dom
img_call = function(url){
$('<img />').attr('src', url).load(function(){console.log(this.width); console.log(this.height);});
};
// Image Dimension return version
img_attr = function(url){
var img_attributes = {};
$('<img />').attr('src', url).load(function(){
img_attributes.width = this.width;
@Neener54
Neener54 / opensuse_rails.sh
Created September 15, 2012 14:08
OpenSuse Version of Rails Girls
set -e
echo "Updates packages. Asks for your password."
sudo zypper update
echo "Installs packages. Give your password when asked."
sudo zypper install build-essential bison openssl libmagic-dev libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 mysql-client mysql-server libmysql-ruby libmysqlclient-dev libxml2-dev libxslt-dev autoconf libc6-dev nodejs
echo "Installs ImageMagick for image processing"
sudo zypper install imagemagick
@Neener54
Neener54 / js_helps.md
Last active July 15, 2023 18:35
Javascript Helps

Keep in mind that most of these articles are opinionated and you may not agree with every one of them, that's fine. Learn what you can, figure out how to improve your code and if you know of some other resources let's add them to the list.

Javascript Basics:

@Neener54
Neener54 / venue.rb
Created November 8, 2012 03:25
Venu
class VenuesController < ApplicationController
def create
@user = User.find(current_user)
@venue = Venue.where(:user => @user)
if @venue.blank?
@venue = Venue.create(params[:venue])
end
end
end
@Neener54
Neener54 / gist:4036557
Created November 8, 2012 03:35
Venues Controllers
class VenuesController < ApplicationController
def venue_thanks
@user = User.find(current_user)
@venue = Venue.where(:user_id => @user.id)
if @venue.blank?
@venue = Venue.new(:name => params[:name], :address => params[:address], :max_guest_allowed => params[:max_guest_allowed], :user_id => @user )
@msg = "Thanks for creating a venue!"
@venue.save
else
@Neener54
Neener54 / wtf.js
Created November 30, 2012 19:29
jason_jquery
jQuery(container)
  .append(jQuery('<div/>')
.addClass('blowout-item-picture')
            .append(
jQuery('<img/>').attr('src', 'http://s3.amazonaws.com/ifrogz-images/images/promo/blowout/blowout-item-test.jpg')
)
)
  .append(jQuery('<div/>')
.addClass('blowout-item-name')
.html(cat)