Skip to content

Instantly share code, notes, and snippets.

@fabiobiondi
fabiobiondi / App.js
Last active April 14, 2019 17:21
EaselJS and HTML5 Canvas - ES6 Custom Display Objects (based on ES5 version: http://www.createjs.com/tutorials/Inheritance/)
import CircleButton from './CircleButton';
// Init stage
const stage = new createjs.Stage("demo");
// Button black
const btn = new CircleButton('Hi');
btn.x = 50; btn.y = 50;
stage.addChild(btn);
@erogol
erogol / crawle_google.py
Created September 22, 2013 10:57
scrap google images given the target query
#!/usr/bin/env python
'''
Query on GoogleImageSearch and install resulted images by scraping.
To use this script install mechanize and BeautifulSoup packages as
easy_install mechanize
easy_install Beautiful
@philfreo
philfreo / bucket_policy.js
Created October 6, 2012 01:27
AWS S3 bucket policy to make all files public (+CORS)
{
"Statement": [
{
"Sid": "AllowPublicRead",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket_name_here/*"
1. master> git pull origin master
2. master> git branch temp_branch
3. master> git checkout temp_branch
4. temp_branch> ...Do your stuff and commit...
5. temp_branch> git checkout master
6. master> git pull origin master
7. master> git checkout temp_branch
8. temp_branch> git rebase master
9. temp_branch> git checkout master
10. master> git merge temp_branch
@huangzhichong
huangzhichong / selenium-webdriver-cheatsheet.md
Created August 7, 2012 12:38
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
@WizardOfOgz
WizardOfOgz / gist:1012107
Created June 7, 2011 12:13
Save Base64-encoded images with Paperclip
class Avatar < ActiveRecord::Base
attr_accessor :content_type, :original_filename, :image_data
before_save :decode_base64_image
has_attached_file :image,
PAPERCLIP_CONFIG.merge(
:styles => {
:thumb => '32x32#',
:medium => '64x64#',
def avatar_geometry(style = :original)
@geometry ||= {}
@geometry[style] ||= Paperclip::Geometry.from_file(avatar.to_file(style))
end
namespace :load do
ZIP_CODE_DATA_URL = 'http://www.census.gov/tiger/tms/gazetteer/zips.txt'
# Swiped from ActiveRecord migrations.rb
def announce(message)
length = [0, 75 - message.length].max
puts "== %s %s" % [message, "=" * length]
end