Skip to content

Instantly share code, notes, and snippets.

View bigardone's full-sized avatar
🏠
Working from home

Ricardo García Vega bigardone

🏠
Working from home
View GitHub Profile
/*!
* jQuery Tiny Pub/Sub - v0.6 - 1/10/2011
* http://benalman.com/ see https://gist.github.com/661855
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* (removed pre 1.4.3 support, added $.pubsubdebug())
*/
@rjz
rjz / cs-jq-plugin-template.coffee
Created September 3, 2012 17:01
Coffeescript jQuery Plugin Class Template
# A class-based template for jQuery plugins in Coffeescript
#
# $('.target').myPlugin({ paramA: 'not-foo' });
# $('.target').myPlugin('myMethod', 'Hello, world');
#
# Check out Alan Hogan's original jQuery plugin template:
# https://github.com/alanhogan/Coffeescript-jQuery-Plugin-Template
#
(($, window) ->
@pamelafox
pamelafox / browser.js
Created February 13, 2013 17:35
Browser banner warning
(function(wndw) {
var Browsers, OS, Platform, Versions, browser_name, browser_version, os, platform;
Versions = {
Firefox: /firefox\/([\d\w\.\-]+)/i,
IE: /msie\s([\d\.]+[\d])/i,
Chrome: /chrome\/([\d\w\.\-]+)/i,
Safari: /version\/([\d\w\.\-]+)/i,
Ps3: /([\d\w\.\-]+)\)\s*$/i,
Psp: /([\d\w\.\-]+)\)?\s*$/i
};
@amaanr
amaanr / application.html.erb
Last active December 17, 2015 20:46
Using Rails & Devise with Ember.js
<!DOCTYPE html>
<html>
<head>
<title>App</title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%- if user_signed_in? %>
<meta name="current-user" content="<%= UserSerializer.new(current_user).to_json(root: false) %>" />
@bgkittrell
bgkittrell / aws-transcode.rb
Created June 11, 2013 13:57
Uploads a directory of files to s3 and creates elastic transcoder jobs. Requires the aws-sdk gem. Usage ruby aws-transcode.rb /path/to/videos
require 'aws'
AWS.config(:access_key_id => 'XXXXX', :secret_access_key => 'XXXXX')
pipeline_id = 'XXXXXXX'
preset_id = 'XXXXXX'
s3 = AWS::S3.new
bin = s3.buckets['XXXXXX-in']
bout = s3.buckets['XXXXXX-out']
@JamesDullaghan
JamesDullaghan / digitalocean.md
Created July 6, 2013 20:54
Deploy rails app to digitalocean with nginx, unicorn, capistrano & postgres

Deploy Rails app to digitalocean with nginx, unicorn, capistrano & postgres

Create droplet of your liking (ubuntu 12.10 x32)

ssh to root in terminal with your server ip

ssh root@123.123.123.123

Add ssh fingerprint and enter password provided in email

@ka8725
ka8725 / dbconfig.rake
Last active July 28, 2016 10:03
database.yml generator. Global Rake implementation
require 'yaml'
desc 'Generates database.yml, optional arguments: [adapter, user, password]'
task :dbconfig => 'database.yml'
file 'database.yml', [:adapter, :username, :password] do |t, args|
Dir.chdir('config')
args.with_defaults(:project_path => Dir.pwd)
DBConfigGenerator.new(t, args).generate
end
@bensmithett
bensmithett / AppComponent.cjsx
Last active April 20, 2020 06:59
The world's tiniest guide to getting started with React, JSX, CoffeeScript & Webpack
React = require("react")
VideoPlayerComponent = require("components/VideoPlayerComponent")
AppComponent = React.createClass
# Need to add this manually if you want it to show up in React Chrome Dev Tools
# See https://github.com/jsdf/coffee-react-transform/issues/16
displayName: "AppComponent"
render: ->
<div>
@henrik
henrik / deploying_phoenix_on_dokku.md
Last active April 14, 2024 00:32
Deploying Elixir's Phoenix Framework on Dokku.

Deploying Phoenix on Dokku

Worked 2015-09-08 for Phoenix 1.0.1 on Dokku 0.3.25.

These instructions assume you've set up Dokku. If not, go find a tutorial for that part. My notes for setting it up on Digital Ocean.

On your local machine, in the app's repo

Create a Dokku app:

@ustun
ustun / eslint-auto.el
Created January 12, 2016 23:59
run eslint --fix on emacs file save
;;; runs eslint --fix on the current file after save
;;; alpha quality -- use at your own risk
(defun eslint-fix-file ()
(interactive)
(message "eslint --fixing the file" (buffer-file-name))
(shell-command (concat "eslint --fix " (buffer-file-name))))
(defun eslint-fix-file-and-revert ()
(interactive)