Skip to content

Instantly share code, notes, and snippets.

@zeqk
zeqk / 0_reuse_code.js
Last active August 29, 2015 14:22
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V –All
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
inAppBrowser
http://ngcordova.com/docs/plugins/inAppBrowser/
Force download our open file Pdf:
var options = {
location: 'yes',
clearcache: 'yes'
};
@zeqk
zeqk / apple_cert_openssl.cmd
Created October 26, 2017 17:59
apple certificate openssl
openssl x509 -inform DER -outform PEM -in ios_development.cer -out ios_development.cer.pem
openssl pkcs12 -export -inkey keyname.key -in ios_development.cer.pem -out Certificates.p12
public interface IFoo {}
public abstract class MyClass<T>
where T : class, IFoo
{
}
class Base { }
class Test<T, U>
where U : struct
@zeqk
zeqk / user.js
Created January 2, 2018 16:05 — forked from EtienneR/user.js
XMLHttpRequest RESTful (GET, POST, PUT, DELETE)
// Get all users
var url = "http://localhost:8080/api/v1/users";
var xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.onload = function () {
var users = JSON.parse(xhr.responseText);
if (xhr.readyState == 4 && xhr.status == "200") {
console.table(users);
} else {
console.error(users);
#region Hide System.Object inherited methods
/// <summary>
/// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
/// </summary>
/// <returns>
/// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
/// </returns>
/// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>. </param><filterpriority>2</filterpriority>
[EditorBrowsable(EditorBrowsableState.Never)]
var request = new XMLHttpRequest();
request.open('GET', '/bar/foo.txt', false); // `false` makes the request synchronous
request.send(null);
if (request.status === 200) {
console.log(request.responseText);
}
@zeqk
zeqk / gist:e51ca8ad4366af6f6e5eb165a2a71442
Created January 12, 2018 00:35 — forked from Buthrakaur/gist:1613003
NHibernate QueryOver.List extension to support casting to anonymous types
public static IList<TRes> ListAs<TRes>(this IQueryOver qry, TRes resultByExample)
{
var ctor = typeof (TRes).GetConstructors().First();
return qry.UnderlyingCriteria
.SetResultTransformer(Transformers.AliasToBeanConstructor(ctor))
.List<TRes>();
}
[Fact]
public void ListAs_Should_CastQueryOverResultToTypeSameAsSupliedExampleInstance()
param([string]$installationType = "NONE")
Set-Content -Path "modules.txt" -Value "" -Force;
Get-Content "a1f.webapi.$($installationType.ToLower()).sln" |
Select-String 'Project\(' |
ForEach-Object {
$projectParts = $_ -Split '[,=]' | ForEach-Object { $_.Trim('[ "{}]') };
If($projectParts[1].startswith("a1f.")) {
Add-Content -Path "modules.txt" -Value $projectParts[1] -Force;