This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
token whitespace = /[ \n\t]+/ [ skip ]; | |
token true = /true/; | |
token false = /false/; | |
token and = /and/; | |
token or = /or/; | |
rule S = expr; | |
rule expr = tkn | expr and tkn | expr or tkn; | |
rule tkn = true | false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run -it homebrew/brew Unable to find image 'homebrew/brew:latest' locally | |
latest: Pulling from homebrew/brew e92ed755c008: Pull complete | |
b9fd7cb1ff8f: Pull complete | |
ee690f2d57a1: Pull complete | |
53e3366ec435: Pull complete | |
5ab15df03195: Pull complete | |
10ac880b02d1: Pull complete | |
bddb162b792c: Pull complete | |
Digest: sha256:fc1a1df1056c47660b0bc23e690cd2f9d6d2c3176513fea7d40d669ad2823dd1 | |
Status: Downloaded newer image for homebrew/brew:latest root@816c4762d86c:/home/linuxbrew# brew install crystal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/bash | |
pegasus < parser.grammar > parser.json | |
pegasus-crystalsem -l parser.json -a parser.sem -s parser.cr | |
crystal test.cr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DROP TABLE videos; | |
DROP TABLE video_releases; | |
DROP TABLE actors; | |
DROP TABLE performances; | |
CREATE TABLE videos ( | |
id integer NOT NULL, | |
title varchar(40) NOT NULL | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Seller < ActiveRecord::Base | |
has_one :business | |
accepts_nested_attributes_for :business | |
devise :database_authenticatable, :registerable, :token_authenticatable, | |
:lockable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable | |
attr_accessible :email, :password, :last_name, :first_name, :remember_me, :business_attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Seller < ActiveRecord::Base | |
has_one :business | |
accepts_nested_attributes_for :business | |
devise :database_authenticatable, :registerable, :token_authenticatable, | |
:lockable, :timeoutable, :recoverable, :rememberable, :trackable, :validatable | |
attr_accessible :email, :password, :last_name, :first_name, :remember_me, :business_attributes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :sync do | |
desc "Backs up heroku database and restores it locally" | |
task production: :environment do | |
Bundler.with_clean_env do | |
system("heroku pgbackups:capture --expire --remote production") | |
timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S") | |
system("curl -o ../pgbackups/production_#{timestamp}.dump --create-dirs `heroku pgbackups:url --remote production`") | |
last_backup = Dir.entries("../pgbackups").last | |
database = Rails.configuration.database_configuration[Rails.env]['database'] | |
system("pg_restore --verbose --clean --no-acl --no-owner -d #{database} ../pgbackups/#{last_backup}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'lastfm' | |
API_KEY = 'XXX' | |
API_SECRET = 'XXX' | |
lastfm = Lastfm.new(API_KEY, API_SECRET) | |
# token = lastfm.auth.get_token | |
token = '435708b60cde32b6df36b8585fe75725' | |
# open http://www.last.fm/api/auth/?api_key=XXXX&token=token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'lastfm' | |
API_KEY = 'XXX' | |
API_SECRET = 'XXX' | |
lastfm = Lastfm.new(API_KEY, API_SECRET) | |
# token = lastfm.auth.get_token | |
token = '435708b60cde32b6df36b8585fe75725' | |
# open http://www.last.fm/api/auth/?api_key=XXXX&token=token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"details":"Ambiguous oauth credentials provided","problem":"You are not authorized to make that request","code":"ambiguous_credentials"} |
NewerOlder