Skip to content

Instantly share code, notes, and snippets.

from math import *
import os
import time
width = 60
height = 40
def clear():
print "\x1b[2J",
require 'paint'
include Math
class Waves
BLOCKS = [ "█", "▓", "▒", "░" ]
attr_reader :width, :height
def initialize
#!/usr/bin/env python2
# coding=utf-8
from math import *
from time import sleep
import os
import random
import sys
write = sys.stdout.write
[11:12 PM] epi@bort :: ~/src/depot_tools $ ./gn
Traceback (most recent call last):
File "./gn.py", line 38, in <module>
sys.exit(main(sys.argv))
File "./gn.py", line 22, in main
bin_path = gclient_utils.GetBuildtoolsPlatformBinaryPath()
File "/home/epi/src/depot_tools/gclient_utils.py", line 713, in GetBuildtoolsPlatformBinaryPath
buildtools_path = GetBuildtoolsPath()
File "/home/epi/src/depot_tools/gclient_utils.py", line 701, in GetBuildtoolsPath
buildtools_path = os.path.join(primary_solution, 'buildtools')
@epitron
epitron / problem.txt
Last active August 29, 2015 14:16 — forked from foucist/quiz.rb
Multi-replace problem
QUESTION 6: Write a function multi_gsub that performs multiple, simultaneous
search-and-replace operations on a string.
Example:
"Lorem Ipsum #9191".multi_gsub([[/[a-z]/i, '#'], [/#/, 'P']])
=> "##### ##### P9191"
Objects have methods and instance variables
A class, and its instances, are Objects
A class is an Object that can create other Objects
An instance is an object that holds data and lets you run methods on it.
self refers to the object in which your code is currently executing
(ie: in an instance method, "self" is the instance
@epitron
epitron / 1_load_facebook_javascript.html
Last active August 29, 2015 14:15
How to make a facebook like button, in 7 complicated steps...
<div id="fb-root"></div>
<script src="//connect.facebook.net/<%= @locale %>/all.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : <%= @fbappid %>, // App ID
<% if Rails.env.production? %>
channelUrl : '//garbage.herokuapp.com/channel.html', // Channel File
<% else %>
channelUrl : '//localhost:3000/channel.html', // Channel File
@epitron
epitron / js_string_extractor.rb
Created February 8, 2015 21:10
Uses the CodeRay JavaScript parser to extract all the strings in JavaScript source code.
require 'coderay'
require 'pp'
require 'epitools'
#
# Example tokenization:
#
# [
# ["toggle", :ident], ["(", :operator],
#!/usr/bin/env ruby
require 'readline'
while line = Readline.readline("crystal> ")
line = %{puts "=> \#{(#{line}).inspect}"}
system("crystal", "eval", line)
end