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
| import smtpd | |
| import asyncore | |
| server = smtpd.DebuggingServer(('127.0.0.1', 1025), None) | |
| asyncore.loop() |
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
| module X | |
| def initialize(params ={}) | |
| puts 'setting params in module x' | |
| @foo = params[:foo] | |
| end | |
| end | |
| module Y | |
| def initialize(params ={}) | |
| super if defined?(super) | |
| puts 'setting params in module y' |
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
| #foo | |
| #bar | |
| #baz | |
| renders | |
| <div id="foo"> | |
| <div id="bar"> | |
| <div id="baz"> | |
| </div> |
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 | |
| echo -e "\033]50;SetProfile=$1\a" | |
| /usr/bin/ssh $* | |
| echo -e "\033]50;SetProfile=Default\a" |
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 pattern = @"[^ -~]"; | |
| string input = THE XML STRING | |
| string replacement = ""; | |
| Regex rgx = new Regex(pattern); | |
| string result = rgx.Replace(input, replacement); | |
| Console.WriteLine("Original String: '{0}'", input); | |
| Console.WriteLine("Replacement String: '{0}'", result); |
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
| foo | |
| ------- | |
| foo_id | |
| name | |
| foo_hierarchy | |
| ------- | |
| foo_child_id | |
| foo_parent_id | |
| 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
| dstarh:danger-danger-squared.local in [/usr/local/site/tools] rm -rf ~/.grails | |
| dstarh:danger-danger-squared.local in [/usr/local/site/tools] |NUT-37-grails-2.1.4-java-7 ✗|$ grails install-plugin sublog --stacktrace | |
| | Installed plugin sublog-0.5.3 | |
| | Error Error executing script InstallPlugin: BUG! exception in phase 'conversion' in source unit 'Script1.groovy' No such property: importPackages for class: org.codehaus.groovy.ast.ModuleNode (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.) | |
| BUG! exception in phase 'conversion' in source unit 'Script1.groovy' No such property: importPackages for class: org.codehaus.groovy.ast.ModuleNode | |
| at org.codehaus.gant.IncludeTargets.leftShift(IncludeTargets.groovy:72) | |
| at org.codehaus.gant.IncludeTargets$leftShift$0.call(Unknown Source) | |
| at InstallPlugin$_run_closure8.doCall(InstallPlugin:246) | |
| at InstallPlugin$_run_closure8.call(InstallPlugin) | |
| at InstallPlugin$_run_closure14_closure29.doCall(InstallPlugin:337) |
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
| log4j = { | |
| appenders { | |
| console name:'stdout', layout:pattern(conversionPattern: '[%r] %c{2} %m%n') | |
| if (tools.error.email.to && Globals.getProperties().SMTP_HOST) { | |
| def patternLayout = new org.apache.log4j.PatternLayout() | |
| patternLayout.setConversionPattern("[%r] %c{2} %m%n") | |
| def mailAppender = new org.apache.log4j.net.SMTPAppender() | |
| mailAppender.setFrom("errors@email.com") | |
| mailAppender.setTo("${tools.error.email.to}") | |
| mailAppender.setSubject("Grails Tools Application Error") |
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
| /* ******************************************* | |
| // LICENSE INFORMATION | |
| // The code, "Detecting Smartphones Using PHP" | |
| // by Anthony Hand, is licensed under a Creative Commons | |
| // Attribution 3.0 United States License. | |
| // | |
| // Updated 01 March 2010 by Bryan J Swift | |
| // - Remove un-needed if statements instead just returning the boolean | |
| // inside the if clause | |
| // |
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
| average = (50.0 + 75.0 + 90.0) / 3.0 => 71.66666666666667 (14 decimal places) | |
| average = ratings.average(:rating).to_f => 71.6666666666667 (13 decimal places) | |
| :rating is a double in postgres. | |