Skip to content

Instantly share code, notes, and snippets.

View sophie-eihpos's full-sized avatar
💉
GMO

Sophie sophie-eihpos

💉
GMO
View GitHub Profile
##Create a new repository on the command line##
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/sifeij/ScratchPaper.git
git push -u origin master
##Push an existing repository from the command line##
@sophie-eihpos
sophie-eihpos / ExtensionMethod
Created November 13, 2012 20:18
Extension Method
using System.Linq;
using System.Text;
using System;
namespace CustomExtensions
{
//Extension methods must be defined in a static class
public static class StringExtension
{
// This is the extension method.
@sophie-eihpos
sophie-eihpos / gist:4073364
Created November 14, 2012 17:06
class Comparer<T>
class Comparer<T> : IEqualityComparer<T>
{
public readonly Func<T, T, bool> _comparer;
public Comparer(Func<T, T, bool> comparer)
{
if (comparer == null)
throw new ArgumentNullException("comparer");
_comparer = comparer;
@sophie-eihpos
sophie-eihpos / gist:4485645
Last active December 10, 2015 20:08
JavaScript Best Practices
1. Use === and !== Instead of == and !=
2. Eval = Bad
3. Do not use short-hand, for example: omitting curly braces and semi-colons
4. Utilize http://www.jslint.com/
5. Place Scripts at the Bottom of Your Page
@sophie-eihpos
sophie-eihpos / LastDayFirstDayOfPreviousCurrentNextMonth.sql
Last active December 14, 2015 12:08
Last Day First Day of Previous Current Next Month
DECLARE @mydate DATETIME
SELECT @mydate = CONVERT(VARCHAR(25),GETDATE(),101)
SELECT DATEADD(dd, -(DAY(@mydate)), @mydate) AS DateValue, 'Last Day of Previous Month' AS DateType
UNION ALL
SELECT DATEADD(s, -1, DATEADD(mm, DATEDIFF(m, 0, @mydate),0)) AS DateValue, 'Last Day of Previous Month' AS DateType
UNION ALL
SELECT DATEADD(dd, -(DAY(@mydate)-1), @mydate) AS DateValue, 'First Day of Current Month' AS DateType
UNION ALL
SELECT DATEADD(m, DATEDIFF(m, 0, @mydate), 0) AS DateValue, 'First Day of Current Month' AS DateType
using System;
using System.IO;
using System.Linq;
namespace ExplicitDependencies
{
class Program
{
static void Main(string[] args)
{
@sophie-eihpos
sophie-eihpos / RSS Downloader.linq
Last active August 24, 2016 01:23
RSS Downloader
<Query Kind="Program">
<NuGetReference>HtmlAgilityPack</NuGetReference>
<Namespace>HtmlAgilityPack</Namespace>
<Namespace>System.Net</Namespace>
</Query>
void Main()
{
var sites = new[] {
"http://www.alvinashcraft.com/",
@sophie-eihpos
sophie-eihpos / JS-LINQ.js
Created March 23, 2017 21:44 — forked from DanDiplo/JS-LINQ.js
JavaScript equivalents of some common C# LINQ methods. To help me remember!
// JS array equivalents to C# LINQ methods - by Dan B.
// Here's a simple array of "person" objects
var people = [
{ name: "John", age: 20 },
{ name: "Mary", age: 35 },
{ name: "Arthur", age: 78 },
{ name: "Mike", age: 27 },
{ name: "Judy", age: 42 },
{ name: "Tim", age: 8 }
@sophie-eihpos
sophie-eihpos / 1DSetups
Last active September 19, 2018 02:39
1DSetups
//@version=2
strategy(title='Beat the Odds 1D setups', shorttitle='1D setups', overlay=true, pyramiding=0, initial_capital=1000, currency=currency.USD)
//----------------- EMA 1 -------------------------------------------------------------------------------------------//
src0 = close, len0 = input(9, minval=1, title="Fast EMA Cross")
emaFast = ema(src0, len0)
direction = rising(emaFast, 2) ? +1 : falling(emaFast, 2) ? -1 : 0
plot_color = direction > 0 ? lime: direction < 0 ? red : na
@sophie-eihpos
sophie-eihpos / 1DAlerts
Last active September 16, 2018 14:10
1DAlerts
//@version=2
study(title='Alert 1D', shorttitle='Alert 1D', overlay=false)
duration=input('9D')
ch1 = security(tickerid, duration, open)
ch2 = security(tickerid, duration, close)
// Signals//
long = crossover(ch2, ch1)