This file contains 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
#!/usr/bin/env ruby | |
require 'mail' | |
mysql_username = 'root' | |
mysql_password = '123456' | |
mysql_database = 'test' | |
system("mysqldump --user=#{mysql_username} --password=#{mysql_password} #{mysql_database} > backup.sql") | |
# Credit to : |
This file contains 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' # gem install sinatra --no-rdoc --no-ri | |
set :port, 3000 | |
set :environment, :production | |
html = <<-EOT | |
<html><head><style> | |
#text{width:100%; font-size: 15px; padding: 5px; display: block;} | |
</style></head><body> | |
<input id="text" placeholder="Write then press Enter."/> | |
<div id="chat"></div> |
This file contains 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 isoCountries = { | |
'AF' : 'Afghanistan', | |
'AX' : 'Aland Islands', | |
'AL' : 'Albania', | |
'DZ' : 'Algeria', | |
'AS' : 'American Samoa', | |
'AD' : 'Andorra', | |
'AO' : 'Angola', | |
'AI' : 'Anguilla', | |
'AQ' : 'Antarctica', |
This file contains 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
## Sample Propel configuration file ## | |
propel: | |
## General settings ## | |
general: | |
# The name of your project. | |
# This affects names of generated files, etc. | |
project: | |
version: 2.0.0-dev |
This file contains 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
app.filter('Autolink', ['$sce', function($sce){ | |
var urlPattern = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])?/gi; | |
return function(text, target, otherProp) { | |
if(text === undefined || | |
text === null ) { return $sce.trustAsHtml(text);} | |
angular.forEach(text.toString().match(urlPattern), function(url) { | |
text = text.replace(url, "<a target=\"" + target + "\" href="+ url + ">" + url.substring(0,30) +"</a>"); | |
}); | |
return $sce.trustAsHtml(text); | |
}; |
This file contains 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
public void sendMessage(String url, String params){ | |
final HttpURLConnection connection; | |
try { | |
URL requestUrl = new URL(url); | |
connection = (HttpURLConnection) requestUrl.openConnection(); | |
connection.setDoOutput(true); | |
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); | |
connection.setRequestProperty("Content-Length", Integer.toString(params.getBytes().length)); | |
connection.setRequestProperty("Content-Language", "en-US"); |
This file contains 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
package main | |
import ( | |
"database/sql" | |
"errors" | |
"fmt" | |
_ "github.com/bmizerany/pq" | |
"os" | |
"regexp" | |
"strings" |
This file contains 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
############################################################################# | |
## | |
## extended_gcd.rb | |
## | |
## given non-negative integers a > b, compute | |
## coefficients s, t such that gcd(a, b) == s*a + t*b | |
## | |
def extended_gcd(a, b) | |
# trivial case first: gcd(a, 0) == 1*a + 0*0 |
This file contains 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
import android.content.Context; | |
import android.content.DialogInterface; | |
import android.content.res.TypedArray; | |
import android.preference.DialogPreference; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import com.quietlycoding.android.picker.NumberPicker; | |
public class NumberPickerPreference extends DialogPreference { |