Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
building stuff on Tezos ꜩ

Diego spacecowb0y

💻
building stuff on Tezos ꜩ
View GitHub Profile
View api.rb
before '/api/*' do
headers "Access-Control-Allow-Origin" => "*"
headers "Access-Control-Allow-Headers" => "Authorization,Accepts,Content-Type,X-CSRF-Token,X-Requested-With"
headers "Access-Control-Allow-Methods" => "GET,POST,PUT,DELETE,OPTIONS"
content_type :json
end
View output.txt
*** CENTROS COMERCIALES F√úURCARRE ***
L U C E N A
CIF: A28425270
Te1f.Atención a1 CHente: 902202000
1 PATAT FREIR 4K CYO 3,55
L SEMI COVAP 1L
6 X ( 0,85) 5,10
L SEMI COVAP 1L
View cadenas-de-supermercados.md
View application_controller.rb
class ApplicationController < ActionController::Base
before_action :set_raven_context
def set_raven_context
Raven.user_context({ user_id: current_user.id, email: current_user.email }) unless current_user.blank?
end
end
View gulp-psd.js
var through = require('through2');
var gutil = require('gulp-util');
var PluginError = gutil.PluginError;
var PSD = require('psd');
function NoopPlugin(file, encoding, callback) {
if (file.isNull() || file.isDirectory()) {
this.push(file);
View calendar-template.html
<script id="dot-template" type="text/template">
<div class="clndr-controls">
<div class="clndr-previous-button">&lsaquo;</div>
<div class="month">{{= it.month }}</div>
<div class="clndr-next-button">&rsaquo;</div>
</div>
<div class="clndr-grid">
<div class="days-of-the-week">
{{~it.daysOfTheWeek :day:index}}
<div class="header-day">{{= day }}</div>
View Browser and OS detection
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(e(){9 d={t:e(){6.f=6.k(6.u)||"K l f";6.v=6.m(3.7)||6.m(3.L)||"w l v";6.n=6.k(6.x)||"w l n"},k:e(a){M(9 i=0;i<a.y;i++){9 b=a[i].4;9 c=a[i].z;6.o=a[i].8||a[i].2;g(b){g(b.A(a[i].5)!=-1)h a[i].2}N g(c)h a[i].2}},m:e(a){9 b=a.A(6.o);g(b==-1)h;h O(a.P(b+6.o.y+1))},u:[{4:3.7,5:"B",2:"B"},{4:3.7,5:"p",8:"p/",2:"p"},{4:3.j,5:"Q",2:"R",8:"S"},{z:C.T,2:"U"},{4:3.j,5:"D",2:"D"},{4:3.j,5:"V",2:"W"},{4:3.7,5:"E",2:"E"},{4:3.j,5:"F",2:"F"},{4:3.7,5:"q",2:"q"},{4:3.7,5:"G",2:"X",8:"G"},{4:3.7,5:"Y",2:"r",8:"Z"},{4:3.7,5:"r",2:"q",8:"r"}],x:[{4:3.s,5:"10",2:"11"},{4:3.s,5:"H",2:"H"},{4:3.7,5:"I",2:"I/12"},{4:3.s,5:"J",2:"J"}]};d.t();C.$.13={14:d.n,f:d.f}})();',62,67,'||identity|navigator|string|subString|
@spacecowb0y
spacecowb0y / User Model
Created Mar 31, 2011
default name: "Chuck Norris"
View User Model
class User
include DataMapper::Resource
# PROPERTIES
property :id, Serial
property :fullname, String, :default => "Chuck Norris"
property :password, String
property :created_at, DateTime
property :updated_at, DateTime
View gist:908062
def password_changed?
new? or dirty_attributes.has_key?(:password)
end
View Time in Words - Ruby Helper
def time_ago_in_words(timestamp)
minutes = (((Time.now - timestamp).abs)/60).round
return nil if minutes < 0
case
when minutes < 1 then "less than a minute ago"
when minutes == 1 then "1 minute ago"
when minutes < 50 then "#{minutes} minutes ago"
when minutes < 90 then "1 hour ago"
when minutes < 1440 then "#{(minutes / 60).round} hours ago"
else