Skip to content

Instantly share code, notes, and snippets.

View bizworld's full-sized avatar

biz man bizworld

View GitHub Profile

Keybase proof

I hereby claim:

  • I am bizworld on github.
  • I am bizworld (https://keybase.io/bizworld) on keybase.
  • I have a public key ASCz9vmIPmd-VJWee77zGWQjMPJSDmn2xKmOJN5ULU_nrQo

To claim this, I am signing this object:

@hugobowne
hugobowne / tweet_listener.py
Last active October 6, 2023 18:48
NOTE: this code is for a previous version of the Twitter API and I will not be updating in the near future. If someone else would like to, I'd welcome that! Feel free to ping me. END NOTE. Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100…
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1

Hash

A Hash is like a cabinet full of tagged folders. When you open the cabinet, you can choose the folder at a glance. A Hash stores data in key/value pairs. The new hash is the cabinet (just think about it as the name of the hash), the keys are the tagged folders, and the values are the sheets of paper inside the folder (think of the papers as Strings, Numbers, Arrays, etc).

Key

Hash keys, unlike like Arrays, can be: (1) strings, (2) numbers, (3) symbols and (4) arrays (though i don't see any use for this).

Unlike arrays, theres no need to know the order of the item. Therefore, a Hash is very useful for storing data (models) without any particular order.

Value

Hash values can be any ruby object. E.g: objects, methods, strings, numbers, floats, etc.

@bizworld
bizworld / Solar-System.markdown
Last active November 30, 2016 18:25
The Solar System

Solar System

This is based on the Sun, Earth, and Code course by Andy Kim on Codecademy.

A Pen by biz man on CodePen.

License.

An Excerpt From William James' Pragmatism

See http://www.authorama.com/pragmatism-2.html

The history of philosophy is to a great extent that of a certain clash of human temperaments. Undignified as such a treatment may seem to some of my colleagues, I shall have to take account of this clash and explain a good many of the divergencies of philosophers by it. Of whatever temperament a professional philosopher is, he tries when philosophizing to sink the fact of his temperament. Temperament is no conventionally recognized reason, so he urges impersonal reasons only for his conclusions. Yet his temperament really gives him a stronger bias than any of his more strictly objective premises. It loads the evidence for him one way or the other, making for a more sentimental or a more hard-hearted view of the universe, just as this fact or that principle would. He trusts his temperament. Wanting a universe that suits it, he believes in any representation of the universe that does suit it. He feels men of o

<body>
<div id="press_button">Press</div>
<div id="space"><div id="line"></div><div id="time"></div>Don't for get to read all the articles on how to be a better person. It might come in handy! Or not...</div>
</body>
@A-J-C
A-J-C / index.html
Created June 1, 2013 21:33
A CodePen by Alex C. Backlight Message - Click the press button to make a special message come to life!
<body>
<div id="press_button">Press</div>
<div id="space"><div id="line"></div><div id="time"></div>Don't for get to read all the articles on how to be a better person. It might come in handy! Or not...</div>
</body>
@agnoster
agnoster / README.md
Last active April 6, 2024 22:35
My ZSH Theme

agnoster.zsh-theme

A ZSH theme optimized for people who use:

  • Solarized
  • Git
  • Unicode-compatible fonts and terminals (I use iTerm2 + Menlo)

For Mac users, I highly recommend iTerm 2 + Solarized Dark

@jfarmer
jfarmer / 01-truthy-and-falsey-ruby.md
Last active April 16, 2024 03:40
True and False vs. "Truthy" and "Falsey" (or "Falsy") in Ruby, Python, and JavaScript

true and false vs. "truthy" and "falsey" (or "falsy") in Ruby, Python, and JavaScript

Many programming languages, including Ruby, have native boolean (true and false) data types. In Ruby they're called true and false. In Python, for example, they're written as True and False. But oftentimes we want to use a non-boolean value (integers, strings, arrays, etc.) in a boolean context (if statement, &&, ||, etc.).

This outlines how this works in Ruby, with some basic examples from Python and JavaScript, too. The idea is much more general than any of these specific languages, though. It's really a question of how the people designing a programming language wants booleans and conditionals to work.

If you want to use or share this material, please see the license file, below.

Update

@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})