Skip to content

Instantly share code, notes, and snippets.

@jchris
jchris / couchapp.html
Created November 27, 2010 15:14
the smallest possible CouchApp
<!DOCTYPE html>
<html>
<!-- This should be the simplest possible jQuery based CouchApp. Install by uploading to a design document in Futon or putting in _attachments/index.html and running `couchapp push` -->
<head><title>Tiny CouchApp</title></head>
<body>
<h1>Tiny CouchApp</h1>
<ul id="databases"></ul>
</body>
<script src="/_utils/script/jquery.js"></script>
<script src="/_utils/script/jquery.couch.js"></script>
@raybrownco
raybrownco / rem.scss
Created August 9, 2011 16:48
rem() is a Sass mixin that converts pixel values to rem values for whatever property is passed to it.
/*
* 'rem' is a Sass mixin that converts pixel values to rem values for whatever property is passed to it.
* It returns two lines of code — one of the regular pixel values (for IE), and another with the
* converted rem values (for everyone else). Special thanks to Chris Epstein (http://chriseppstein.github.com)
* and Martin Bavio (http://martinbavio.com) for the help and code!
*
* Sample input:
* .element {
* @include rem('padding',10px 0 2px 5px);
* }
# encoding: utf-8
module Trashable
extend ActiveSupport::Concern
included do
define_model_callbacks :trash, :only => [ :after, :before ]
default_scope where('trashed_at IS NULL')
scope :trashed, where('trashed_at IS NOT NULL')
end
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
anonymous
anonymous / clickmap.js
Created August 14, 2012 13:30
$(document).ready(function() {
// create canvas
var canvas = document.createElement("canvas");
canvas.height = 300; // important! because default canvas size is 300x150
var ctx = canvas.getContext('2d');
// create img
var img = document.createElement("img");
// IMPORTANT adding shadow map - each area has different background color
@JakubTesarek
JakubTesarek / InnoDb_fulltext.sql
Created April 8, 2013 11:11
Fulltext searching in InnoDb table.
-- MAIN INNODB TABLE FOR ARTICLES
CREATE TABLE `article` (
`id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT,
`title` VARCHAR(50) NOT NULL,
`abstract` TEXT NOT NULL,
`content` MEDIUMTEXT NOT NULL,
`publish_date` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
@gnutix
gnutix / DoctrineDbalStatementInterface.php
Created December 2, 2013 09:07
Mock Builder for Doctrine EntityManager / Connection mock objects.
<?php
namespace Mocks;
use Doctrine\DBAL\Driver\Statement;
/**
* Doctrine DBAL Statement implementing \Iterator.
*
* This class has been created because of a bug in PHPUnit Mock Objects.
@emad-elsaid
emad-elsaid / twitter-thanks.rb
Created February 27, 2014 10:21
create a thanks for following me twitter bot using ruby
#!/usr/bin/env ruby
require 'Twitter'
# Create a read write application from :
# https://apps.twitter.com
# authenticate it for your account
# fill in the following
config = {consumer_key: '', consumer_secret: '',
access_token: '', access_token_secret: ''}
me = 'Blaze Boy' # to prevent DM yourself
@kaja47
kaja47 / csfd-crawler.php
Created March 12, 2014 01:06
Example crawler using Matcher and AsyncCurl
<?php
use Atrox\Matcher;
use Atrox\Curl;
use Atrox\Async;
$userListMatcher = Matcher::multi('//table[@class="ui-table-list"]//tr', (object) [
'url' => Matcher::single('td/a/@href')->map(function ($x) { return "http://www.csfd.cz$x"; }),
'points' => Matcher::single('td[3]')->asInt(),
'ratings' => Matcher::single('td[4]')->asInt(),
@PavelGavlik
PavelGavlik / gulpfile-production.js
Created June 6, 2014 12:18
Sample Phở Devstack config for a Wordpress theme
// For all available options, see node_modules/pho-dev-stack/config.js
// These are production build settings, see gulpfile.js for development settings
var gulp = require('gulp');
var extend = require('node.extend');
var substituteConfig = require('./substitute-config');
require('pho-devstack')(gulp, {
dist: {
/* Directories and file patterns for build output */