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 / json.md
Last active August 29, 2015 14:05
onjson

JSON

The two methods to conver data.

JSON.stringify JSON.parse

var user = JSON.stringify({name: 'dave', age: 1977, occupation: 'developer'});
user;
@fakefarm
fakefarm / array_methods.md
Last active August 29, 2015 14:05
JS Array Methods

map (as well as forEach, filter, and similar array methods) passes a second argument to the function it is given: the index of the current element.

forEach

filter

@fakefarm
fakefarm / map_magic.md
Last active August 29, 2015 14:05
map

Learning javascript's map() and other magic.

Map returns the value of an array, as a new array.

In my quest to learn it, I went to mozialla and found the explaination unclear. I started playing around with it to learn it.

var pets = ['cat', 'dog', 'mouse', 'bird']
var more_pets = pets.map(function(value){
return value;
})
@fakefarm
fakefarm / reduce.md
Created August 26, 2014 15:04
reduce
function reduce(array, start, callback) {
  // javascript, and all of programming often needs variables to contain state.
  var current = start, 
      freq = array.length; 
      

  for (var i = 0; i < freq; i++){
    // how much of learning is problem solving vs. syntax?
 current = callback(current, array[i]); 
@fakefarm
fakefarm / js_object.md
Last active August 29, 2015 14:05
js Objects
@fakefarm
fakefarm / bind_call_apply.md
Created August 29, 2014 22:06
call, bind, apply

Notes from Eloquent JavaScript

Recall that the apply and bind methods both take a first argument that can be used to simulate method calls. This first argument is in fact used to give a value to this.

There is a method similar to apply, called call. It also calls the function it is a method of but takes its arguments normally, rather than as an array. Like apply and bind, call can be passed a specific this value.

speak.apply(fatRabbit, ["Burp!"]);
// → The fat rabbit says 'Burp!'
speak.call({type: "old"}, "Oh my.");
@fakefarm
fakefarm / reload.html
Created October 22, 2014 21:30
Add this to a file you want to reload during development.
<script>document.write('<script src="http://' + (location.host || 'localhost').split(':')[0] + ':35729/livereload.js?snipver=1"></' + 'script>')</script>
@fakefarm
fakefarm / bash.sh
Created November 26, 2014 00:31
bash things
# make a command and come back to same directory
(cd foo/; git pull origin master; rm -rf .bundle; bundle)
# iterate over items and do something with them.
for i in payments accounts deals promotions
do
cd ~/Code/$i
rm -rf .bundle
@fakefarm
fakefarm / tweak.css
Created January 30, 2015 00:27
About text
.superbox-inner {
outline: 1px solid #404041;
border: none;
float: left;
display: block;
padding: 93px 97px;
background: rgba(255, 255, 255,0.9);
position: fixed;
top: 10px;
left: 0px;
@fakefarm
fakefarm / amazon2.rb
Created April 15, 2012 02:00
Code Academy exercise
# Exercise 1 : Your output should look like this: "Your total with tax is $4455.54."
shopping_cart = [
{:name => "iPad 2", :price => 499, :quantity => 2},
{:name => "iMac 27", :price => 1699, :quantity => 1},
{:name => "MacBook Air 13", :price => 1299, :quantity => 1}
]