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/bash -e | |
| if [[ $BUILD_NUMBER == 1 ]] | |
| then | |
| mkdir -p tmp/{media/final_outputs,pids,cache} | |
| fi | |
| ./configure | |
| perl -pi -e "s/mero_test/${JOB_NAME}/g" $WORKSPACE/config/mongoid.yml |
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
| # Find ports | |
| > netstat -tan | grep LIST |
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
| String.prototype.toHHMMSS = function () { | |
| sec_numb = parseInt(this, 10); // don't forget the second parm | |
| var hours = Math.floor(sec_numb / 3600); | |
| var minutes = Math.floor((sec_numb - (hours * 3600)) / 60); | |
| var seconds = sec_numb - (hours * 3600) - (minutes * 60); | |
| if (hours < 10) {hours = "0"+hours;} | |
| if (minutes < 10) {minutes = "0"+minutes;} | |
| if (seconds < 10) {seconds = "0"+seconds;} | |
| var time = hours+':'+minutes+':'+seconds; |
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() { | |
| // See source code from the JSONP handler at https://github.com/highslide-software/highcharts.com/blob/master/samples/data/from-sql.php | |
| $.getJSON('http://www.highcharts.com/samples/data/from-sql.php?callback=?', function(data) { | |
| // Add a null value for the end date | |
| data = [].concat(data, [[Date.UTC(2011, 9, 14, 19, 59), null, null, null, null]]); | |
| // create the chart | |
| window.chart = new Highcharts.StockChart({ |
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
| #Sinatra Authenication Example | |
| https://github.com/timmillwood/millwoodonline | |
| http://skli.se/2013/03/08/sinatra-warden-auth/ | |
| http://codebiff.com/post/roll-your-own-sinatra-authentication.html |
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 'sinatra/base' | |
| require 'rack/flash' | |
| require 'warden' | |
| require 'slim' | |
| require 'sequel' | |
| require 'sqlite3' | |
| DB = Sequel.sqlite | |
| DB.create_table :users do | |
| primary_key :id |
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
| Command Description | |
| d This command is in general the shortcut for “describe”. In other database systems the “desc” keyword is used instead. | |
| dt Displays all your user defined tables. | |
| dT Displays all your user defined data types. | |
| df Displays all your user defined functions. | |
| di Displays all your user defined indexes. | |
| dv Displays all your user defined views. | |
| dn Displays all namespaces. | |
| du Displays all users. | |
| l Displays all databases. |
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
| def find_checksum(card_number) | |
| number_arr = card_number.to_s.reverse.scan(/\d/).map { |x| x.to_i } | |
| number_arr = number_arr.each_with_index.map { |d, i| | |
| d *= 2 if i.even? | |
| d > 9 ? d - 9 : d | |
| } | |
| sum = number_arr.inject(0) { |m, x| m + x } | |
| mod = 10 - sum % 10 | |
| mod==10 ? 0 : mod |
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
| rails g migration AddColumnPermalinkToPost permalink:string | |
| require 'uri' | |
| class Post < ActiveRecord::Base | |
| # Dummy url | |
| URL = "localhost:3000/" | |
| before_save :update_permalink |
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
| http://glennstovall.com/blog/2013/06/27/angularjs-an-overview/?utm_source=javascriptweekly&utm_medium=email | |
| http://net.tutsplus.com/tutorials/javascript-ajax/building-a-web-app-from-scratch-in-angularjs/?utm_source=javascriptweekly&utm_medium=email | |
| http://emberjs.com/guides/concepts/core-concepts/ |