Skip to content

Instantly share code, notes, and snippets.

View fakefarm's full-sized avatar
๐Ÿฝ
๐Ÿฆ๐ŸŽ๐Ÿธ๐Ÿง„๐Ÿ”๐Ÿ๐Ÿน๐Ÿ‘๐Ÿฎ ๐Ÿด๐Ÿฆ†๐Ÿฅฆ๐Ÿ™๐ŸณF๐Ÿฆž๐Ÿง…๐Ÿถ ๐Ÿฆง๐Ÿ‘พA๐Ÿฆˆ๐Ÿ‹๐Ÿ‰K๐ŸŒฝ ๐Ÿฃ๐ŸŽ๐Ÿฆš๐Ÿฆฉ๐Ÿฆ”๐Ÿฟ๐Ÿฆจ๐Ÿ‰๐Ÿฅ• ๐Ÿฟ๐Ÿพ๐Ÿ’๐ŸŠE๐Ÿˆ๐Ÿป๐Ÿฅฅ๐Ÿฑ ๐Ÿผ๐Ÿฅ‘๐Ÿท๐Ÿ“๐ŸŒ๐Ÿ–F๐Ÿฆƒ ๐Ÿ‘๐Ÿšœ๐Ÿ‹๐Ÿ‚A๐Ÿ๐ŸŒพ๐Ÿค–๐Ÿ€๐Ÿฆ” R๐Ÿฆœ๐Ÿฆ๐Ÿˆ๐Ÿฆ“๐Ÿ ๐Ÿฆ‘๐Ÿฆ‚M๐Ÿœ

Dave Woodall fakefarm

๐Ÿฝ
๐Ÿฆ๐ŸŽ๐Ÿธ๐Ÿง„๐Ÿ”๐Ÿ๐Ÿน๐Ÿ‘๐Ÿฎ ๐Ÿด๐Ÿฆ†๐Ÿฅฆ๐Ÿ™๐ŸณF๐Ÿฆž๐Ÿง…๐Ÿถ ๐Ÿฆง๐Ÿ‘พA๐Ÿฆˆ๐Ÿ‹๐Ÿ‰K๐ŸŒฝ ๐Ÿฃ๐ŸŽ๐Ÿฆš๐Ÿฆฉ๐Ÿฆ”๐Ÿฟ๐Ÿฆจ๐Ÿ‰๐Ÿฅ• ๐Ÿฟ๐Ÿพ๐Ÿ’๐ŸŠE๐Ÿˆ๐Ÿป๐Ÿฅฅ๐Ÿฑ ๐Ÿผ๐Ÿฅ‘๐Ÿท๐Ÿ“๐ŸŒ๐Ÿ–F๐Ÿฆƒ ๐Ÿ‘๐Ÿšœ๐Ÿ‹๐Ÿ‚A๐Ÿ๐ŸŒพ๐Ÿค–๐Ÿ€๐Ÿฆ” R๐Ÿฆœ๐Ÿฆ๐Ÿˆ๐Ÿฆ“๐Ÿ ๐Ÿฆ‘๐Ÿฆ‚M๐Ÿœ
View GitHub Profile
@fakefarm
fakefarm / delete_method.md
Last active December 28, 2015 21:49
Why won't you delete?

View

= link_to "delete profile", user_path(@user), method: :delete

Controller

def destroy
  @user = User.find(params[:id])

@user.destroy

@fakefarm
fakefarm / ajax.md
Last active December 29, 2015 14:19
Oh ajax...

show.slim

=link_to votes_path(type: 'Mix', id: @mix.id), method: :post, remote: true do

create.js.erb

alert('hi');

votes_controller.rb

@fakefarm
fakefarm / gem.rb
Created November 27, 2013 22:21
gem file
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
gem "railties"
gem 'jquery-rails'
gem 'filepicker-rails'
gem 'counter_culture', '~> 0.1.18'
gem 'neat'
@fakefarm
fakefarm / nokogiri
Created December 27, 2013 23:32
nokogiri nightmare
gem install nokogiri -- --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib
bundle config build.nokogiri --global --with-xml2-include=/usr/local/Cellar/libxml2/2.9.1/include/libxml2 --with-xml2-lib=/usr/local/Cellar/libxml2/2.9.1/lib
@fakefarm
fakefarm / josh.js
Created April 20, 2014 01:18
remove anchor
var post = $('.wall-post-copy').first();
if (post.children().first().attr('target') == "_blank") {
post.children().first().css('display', 'none') }
@fakefarm
fakefarm / height.js
Last active August 29, 2015 14:02
Get the right height
// Get proper container height
function getContainerHeight(){
var myHeight = $('#my-header').outerHeight(),
var yourHeight = $('#deal-details').height(),
containerHeight = ( myHeight > yourHeight ? myHeight : yourHeight );
return containerHeight;
}
@fakefarm
fakefarm / meta.slim
Created June 12, 2014 21:59
meta data
= content_for :meta do
meta content=FACEBOOK['client_id'] property="fb:app_id" /
meta [email protected] property="og:url" /
meta [email protected]_title property="og:title" /
meta content=@user_sharing.facebook_data[:description] property="og:description" /
meta content=@user_sharing.facebook_data[:photo_url] property="og:image" /
meta content="summary" name="twitter:card" /
meta content="@lettucebooks" name="twitter:site"
meta [email protected] name="twitter:url"
meta [email protected]_title name="twitter:title"
@fakefarm
fakefarm / arguments_as_array.js
Last active August 29, 2015 14:04
Javascript Arguments act as array
// Arguments look like array's but are not. But you can add array functionality with prototype.
function Max(x,y,z) {
var args = Array.prototype.slice.call(arguments);
return args;
}
@fakefarm
fakefarm / indexOf.js
Last active August 29, 2015 14:04
indexOf
// Use index of to check contents of array.
// A function that takes a character (i.e. a string of length 1) and returns true if it is a vowel, false otherwise.
function isVowel(letter) {
vowels = ['a','e','i','o','u'];
var result = vowels.indexOf(letter)
if (result >= 0) {
return true;
}
else {
@fakefarm
fakefarm / sum.js
Created August 14, 2014 11:57
have some fun
function sum ( args ) {
var array, sum = 0; // Set vars
// Conditional to type check what the arguments are
if ( typeof args == 'number' ) { // If not an array, then convert it to one.
array = Array.prototype.slice.call(arguments, 0); // Gotcha, using the key word 'arguments', not the 'args' word. 'arguments' is a special word in javascript that looks like an array, but is not.
} else {
array = args;
}
for ( i in array ) { // I assume recursion could be used here if I knew how recursion worked.