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
| $.post( "/endpoint/url/goes/here", | |
| { | |
| message: "this is an object full of data that you're POST'ing to the server", | |
| A: 69, | |
| S: true, | |
| L: "your dreams" | |
| }, | |
| function( data ) { | |
| console.log("we're in the success callback! everything is fine!"); | |
| console.log("here's what the server returned:", data); |
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
| //the variable "oversimplifiedModule" gets assigned the return value of the anonymous and self executing function | |
| var oversimplifiedModule = (function(){ | |
| //"private" variables are declared within the scope of the anonymous function: "counter" will not be in the global scope. | |
| var counter = 42; | |
| //the return value of the anonymous function can be considered the modules "public" interface | |
| return { | |
| incrementCounter: function(){ | |
| //because we refer to "counter", which is in the outer scope, inside this inner scope, a closure is formed, which keeps a reference to "counter" | |
| //and prevents it from being garbage collected. closures are very neat and useful. |
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
| Set-location "C:\Assemblies" | |
| [System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a") | |
| $publish = New-Object System.EnterpriseServices.Internal.Publish | |
| $assemblyPaths = Get-ChildItem -recurse | select FullName | where { $_.FullName -like "*.dll" } | |
| foreach ($assembly in $assemblyPaths) | |
| { | |
| $publish.GacInstall($assembly.FullName) | |
| } |
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 New-LogicalisMonitoringSuppression{ | |
| [cmdletbinding()] | |
| Param( | |
| [String[]] | |
| [Parameter(Mandatory=$true)] | |
| $Server, | |
| $ShowBrowser = $False | |
| ) | |
| begin{} | |
| process{ |
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 test_put_detail_without_pk(self): | |
| payload = self.dailytotal_post_data.copy() | |
| payload['carbohydrate'] = 69 | |
| # I'd like to support PUT to create on detail resources. | |
| # If there's no pk on the payload for a PUT, tastypie will create it. | |
| # However, there needs to be a token for the pk for the route to match the resource detail route. | |
| # How gross is throwing in a pk that cannot exist in the url, just to get the route to match? | |
| # I haven't had to break out the tastypie source code yet today, and I kind of want to keep it that way | |
| resp = self.api_client.put('/api/v1/dailytotal/-1/', format='json', data=payload) |
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
| public string SessionId() | |
| { | |
| return Session.SessionID; | |
| } |
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
| [cmdletbinding()] | |
| param ( | |
| [parameter(ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true)] | |
| [string[]]$ComputerName = $env:computername | |
| ) | |
| begin {} | |
| process { | |
| foreach ($Computer in $ComputerName) { | |
| if(Test-Connection -ComputerName $Computer -Count 1 -ea 0) { |
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
| $ie = new-object -com internetexplorer.application | |
| $ie.visible = $false | |
| $timer = [System.Diagnostics.Stopwatch]::StartNew() | |
| $ie.navigate2("http://example.com") | |
| while($ie.busy){ | |
| } | |
| $time = $timer.Elapsed.ToString() | |
| $ie.quit() |
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
| using System; | |
| using System.Data; | |
| using System.Data.Common; | |
| using System.Data.SqlClient; | |
| namespace UsingIlTest | |
| { | |
| public class Class1 | |
| { | |
| public Class1() |
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
| //weird codewars function | |
| function _if(bool, func1, func2) { | |
| if(bool === true){ | |
| return func1(); | |
| } else { | |
| return func2(); | |
| } | |
| }; | |
| //arrange |