Skip to content

Instantly share code, notes, and snippets.

@asciant
asciant / gist:2255282
Created March 30, 2012 21:31
Notification CSS
/* Border */
border: 5px solid #eee;
/* Border-Radius */
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
/* Gradient */
background: #fff;
@asciant
asciant / Please.js
Created September 21, 2014 23:15
PleaseJS
var elements = document.getElementsByClassName('section');
Array.prototype.forEach.call(elements, function(element) {
element.style.backgroundColor = Please.make_color({ format: 'rgb-string' });
});
@asciant
asciant / db.rake
Last active December 10, 2016 21:13 — forked from hopsoft/db.rake
Add epoch to filename
# lib/tasks/db.rake
namespace :db do
desc "Dumps the database to db/APP_NAME.dump"
task :dump => :environment do
cmd = nil
epoch = Time.now.to_i
with_config do |app, host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean --no-owner --no-acl --format=c #{db} > #{Rails.root}/db/#{app}-#{epoch}.dump"
end
@asciant
asciant / angular.md
Last active October 30, 2015 20:11
Angular Rails 4.2

Rails 4.2 environment with AngularJS and Foundation 5

New rails project
rails new my_app -T -d postgresql
Update the Gemfile

Add:

http://www.austinstory.com/integrating-wicked-pdf-paperclip-and-mercury-rails-for-an-editable-web-document-that-can-be-exported-to-pdf/
http://botreeconsulting.com/wicked_pdf-generate-pdf-from-haml-template/
https://gist.github.com/micahroberson/5988843
http://snikt.net/blog/2012/04/26/wicked-pdf/
http://www.sitepoint.com/pdf-generation-rails/
@asciant
asciant / lm75a.sh
Created June 12, 2016 01:21 — forked from TheRayTracer/lm75a.sh
This entry contributes a simple Bash script to query and control a LM75 Digital Temperature Sensor via I2C. The second Bash script is a utility to interact with a real-time clock (RTC). The third entry is a Python script for a mini web server to retrieve the temperature in either Celsius (default) or Fahrenheit. These were a few very fun weekend…
#!/bin/bash
readonly lm75=0x48 # Slave address with A0, A1, and A2 set to 0v (ground).
while [ $# -gt 0 ]
do
if [ "$1" == "-debug" ]
then
debug=true
fi
#!/bin/bash
while true;
do
i2cget -y 1 0x48 0x00 w |
awk '{printf("%.1f\n", (a=( \
(("0x"substr($1,5,2)substr($1,3,1))*0.0625)+0.1) \
)>128?a-256:a)}'
@asciant
asciant / regex.ts
Created January 2, 2017 03:41
RegEx Validator angular
emailRegex = /^[a-z0-9!#$%&'+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-][a-z0-9])?(.a-z0-9?)*$/i;
registration : FormGroup;
constructor(r: FormBuilder, public http :Http){
this.registration = r.group({
'chosen_username' : [null, Validators.required],
'chosen_email' : [null, Validators.pattern(this.emailRegex)],
'chosen_password' : [null, Validators.required],
});
}
@asciant
asciant / component.html
Last active January 2, 2017 05:53
Component
<div *ngFor="let item of data | async">
{{ item.data }}
</div>