Skip to content

Instantly share code, notes, and snippets.

@atinypixel
atinypixel / dabblet.css
Created February 20, 2012 23:30
Project Item
/**
* Project Item
*/
body {
background-color: #f0f0f0;
padding: 40px;
}
.item {
margin: 0 0 6px;
@atinypixel
atinypixel / kh_footer.html
Created February 16, 2012 22:50
KearneyHub.com Header and Footer
@atinypixel
atinypixel / get_path.php
Created December 24, 2010 20:32
Function for building paths
function get_path($wildcard="", $remote=false) {
$path = $remote ? "http://".$_SERVER['HTTP_HOST'] : $_SERVER['DOCUMENT_ROOT'];
if($wildcard != "")
$path .= "/".$wildcard."/";
return $path;
}
@atinypixel
atinypixel / issuu.php
Created December 20, 2010 22:13
Issuu API Client for PHP
<?php
/**
* IssuuClient hooks into Issuu's API
*
* example:
* include 'IssuuClient.php';
* $issuu = new IssuuClient(pubKey, privKey, apiAdr);
* $issuu->openAction('issuu.document.url_upload');
* $issuu->slurpUrl = 'pdfurl.pdf';
* $issuu->executeAction();
@atinypixel
atinypixel / _960gs.sass
Created April 28, 2010 16:51
Some basic sass files for rails projects
!ninesixty_gutter_width ||= 20px
!ninesixty_grid_width ||= 960px
!ninesixty_columns ||= 12
=grid-container
margin-left: auto
margin-right: auto
width = !ninesixty_grid_width
=grid-width(!n, !cols = !ninesixty_columns, !gutter_width = !ninesixty_gutter_width)
=cf
display: inline-block
&:after
content: "."
display: block
height: 0
clear: both
visibility: hidden
* html &
height: 1px
# To parse a tweet from twitter to get teh '@' , '#' and the text seperated
parsed_text = tweet.text.gsub(/ ?(@\w+)| ?(#\w+)/) { |a| ((a.include?('#')) ? tags : replies) << a.strip.gsub(/#|@/,''); '' }
# Rails modules for user controllers and models.
module Tiny
module Controller
module Accounts
def self.included(controller)
controller.helper_method(
:current_account,
:account_domain,
:account_subdomain,
# Simple example
# Regex is between these -&gt; \\ and my replacement string is in single quotes
def change_p_tags_to_divs(content)
content.gsub(\<.*?(p)>\, 'div')
end
# Complex example
# This (real) example puts `@tags` in a hyperlink, finds a path (if any) and then spits out the result.
require 'csv'
CSV.open('sample_users.csv', 'r').each do |row|
User.create(:username => row[0], :email => row[1])
end