This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PurdyPercent = function (num, options) { | |
| this.settings = { | |
| hide_decimal_on_whole : true, | |
| decimals : 2, | |
| truncate : false, // (soon) | |
| match_decimals: true, // forces floats to match defined decimal count | |
| postfix : '%' | |
| }; | |
| // helper methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Output file for HTML5 video | |
| # requirements: ffmpeg .6+ | |
| # usage: ./html5video.sh infile.mp4 640x360 | |
| target_directory='converted' | |
| file=`basename $1` | |
| filename=${file%.*} | |
| filepath=`dirname $1` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html class="no-js" lang="en"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
| <title>Foundation | Welcome</title> | |
| <link rel="stylesheet" href="css/foundation.css" /> | |
| <link rel="stylesheet" href="css/app.css" /> | |
| <script src="js/modernizr.js"></script> | |
| </head> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'csv' | |
| file = "#{Rails.root}/public/users.csv" | |
| userrefs = UserReference.where(:tenant_id => 7) | |
| CSV.open( file, 'w' ) do |writer| | |
| userrefs.each do |ur| | |
| next unless ur.user.present? | |
| writer << [ur.user.username, ur.user.email] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SSL self signed localhost for rails start to finish, no red warnings. | |
| # 1) Create your private key (any password will do, we remove it below) | |
| $ openssl genrsa -des3 -out server.orig.key 2048 | |
| # 2) Remove the password | |
| $ openssl rsa -in server.orig.key -out server.key |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ---- | |
| // libsass (v0.7.0) | |
| // ---- | |
| $namespace: false !default; | |
| @function data($attr) { | |
| @if $namespace { | |
| @return '[data-' + $namespace + '-' + $attr + ']'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function(attrs, exp) { | |
| if (typeof attrs === 'object' && attrs !== null) { | |
| var keys = Object.getOwnPropertyNames(attrs), | |
| i = keys.length, | |
| type = ''; | |
| while (i--) { | |
| var attr = attrs[keys[i]]; | |
| if (typeof attr === 'object') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_general_ci; | |
| ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| backup: # mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql | |
| restore:# mysql -u root -p[root_password] [database_name] < dumpfilename.sql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(document).on('valid', '[data-abide]', function () { | |
| var vehicles = $('input:checked', this); | |
| if (vehicles.length > 0) { | |
| // post your form via ajax | |
| } else { | |
| // show custom error message. | |
| } | |
| }); |