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/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
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
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript | |
powered JS and SASS powered CSS with YUI compression all via the magic of rack. | |
This stuff will be native in Rails 3.1 and the layout of the files on the | |
filesystem will be different but this guide will get you working with it | |
while we wait for all that to finalize. | |
Ignore the number prefixes on each file. This is just to ensure proper order in the Gist. | |
It's based on eric1234 gist https://gist.github.com/911003. ijust made it 3.1 compliant in terms of convention |
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
<iframe src="http://embedify.heroku.com/datapoints/" width=100% height=200px > | |
This is an in-line frame. You can <a href="framesrc.html">view the frame</a> and then hit your back arrow to return to the page. | |
</iframe> |
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
<script type="text/javascript" src="http://embedify.heroku.com/widget/datapoints/"></script> |
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
var str = "Dear diary "this" is a string with quotes." | |
str.replace(/"([^"]*)"/g, "''$1''"); |
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
- (void)viewDidLoad { | |
self.currentPage = 0; | |
self.dataSource = [[NSMutableArray alloc] init]; | |
} | |
- (void)fetchData { | |
[[SVHTTPClient sharedClient] GET:@"https://api.github.com/users/AndrewGertig/watched" | |
parameters:[NSDictionary dictionaryWithValue:[NSNumber numberWithInt:self.currentPage] forKey:@"page"] | |
completion:^(id response, NSError *error) { | |
[self.dataSource addObjectsFromArray:response]; |
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
# Server App | |
# This file must be in lib/myapp/api.rb | |
module MyApp | |
module Entities | |
class Products < Grape::Entity | |
expose :id, :code, :name, :short_description | |
expose :description, :unless => { :collection => true } | |
expose (:category) { |model, options| model.category.name } | |
expose (:brand) { |model, options| model.brand.name } | |
end |
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 'rubygems' | |
require 'nokogiri' | |
require 'open-uri' | |
def is_numeric_or_short(str) | |
return str.length <= 5 | |
end | |
url = "http://news.ycombinator.com" | |
doc = Nokogiri::HTML(open(url)) |
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 'mechanize' | |
@username = 'user@domain.com' | |
@password = 'hi2u' | |
@download_path = File.expand_path 'downloads' | |
@wget_cookie = File.expand_path(File.dirname(__FILE__)) + '/wget-cookies.txt' | |
unless File.directory? @download_path | |
puts "@{download_path} doesn't exist!" | |
exit |
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
#registrations_controller.rb | |
class RegistrationsController < Devise::RegistrationsController | |
def create | |
params[:user][:password_confirmation] = params[:user][:password] | |
super | |
end | |
end | |
<!-- Inside any View ---> | |
<%= form_for(:user, :url => "#", :html => { :id => "ajax_signup"}) do |f| %> |