Skip to content

Instantly share code, notes, and snippets.

View motdotla's full-sized avatar
🏆

Mot motdotla

🏆
View GitHub Profile
-webkit-animation: writeText 0.5s ease; /* Safari 4+ */
-moz-animation: writeText 0.5s ease; /* Fx 5+ */
-o-animation: writeText 0.5s ease; /* Opera 12+ */
animation: writeText 0.5s ease; /* IE 10+ */
&:nth-child(1) {
-webkit-animation-duration: 0.5s;
}
&:nth-child(2) {
-webkit-animation-duration: 1s;
@motdotla
motdotla / sprockets-internals.rb
Last active December 15, 2015 13:58
Learning sprockets internals
sprockets_env = Sprockets::Environment.new
sprockets_env.append_path("app/assets/stylesheets")
sprockets_env.paths
sprockets_env['application.css']
sprockets_env['application.css'].required_assets
sprockets_env['application.css'].dependency_paths
sprockets_env.stat("application.css").mtime
public_assets = 'public/assets/application.css'
pathname = sprockets_env['application.css'].pathname
bundled_asset = Sprockets::BundledAsset.new(sprockets_env, public_assets, pathname)
@motdotla
motdotla / gist:5183011
Last active December 15, 2015 01:49 — forked from ewilliam/gist:5171037
class User < ActiveRecord::Base
attr_accessible :name, :email, :password, :password_confirmation, :lvl, :xp, :hp, :ap, :max_xp, :max_hp, :max_ap, :type
has_secure_password
before_save { email.downcase! }
before_save :create_remember_token
validates :name, presence: true, length: { maximum: 50 }
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
validates :email, presence: true, format: { with: VALID_EMAIL_REGEX },
@motdotla
motdotla / gist:3717570
Created September 13, 2012 20:54 — forked from jcblw/gist:3717552
Angular JS routeParams
/* Services */
//app
angular
.module('support', ['supportService'])
.config(['$routeProvider', function($routeProvider){
$routeProvider
.when('/p/:start', {templateUrl: '/partials/warrantyList.html', controller: SupportListController})
.when('/v/:field/:id/', {templateUrl: '/partials/warrantyDetails.html', controller: SupportDetailController})
.otherwise({redirectTo: '/p/1'});
express = require("express")
app = express()
Person = require('./app/models/person')
app.configure ->
app.use express.bodyParser()
VALID_EMAIL = "[email protected]"
VALID_PASSWORD = "password"
VALID_API_TOKEN = "12345"
express = require("express")
app = express()
app.configure ->
app.use express.bodyParser()
VALID_EMAIL = "[email protected]"
VALID_PASSWORD = "password"
VALID_API_TOKEN = "12345"
express = require("express")
app = express()
app.configure ->
app.use express.bodyParser()
VALID_EMAIL = "[email protected]"
VALID_PASSWORD = "password"
app.get "/", (req, res) ->
request = require 'request'
should = require 'should'
describe "GET /api/test.json", ->
url = "http://localhost:3000/api/test.json"
it "returns a success response", (done) ->
request.get {url: url}, (e, res) ->
json = JSON.parse res.body
json.success.should.equal(true)
express = require("express")
app = express()
app.configure ->
app.use express.bodyParser()
app.get "/", (req, res) ->
res.send "API"
app.get "/api/test.json", (req, res) ->
express = require("express")
app = express()
app.configure ->
app.use express.bodyParser()
app.get "/", (req, res) ->
res.send "API"