Skip to content

Instantly share code, notes, and snippets.

View gmertk's full-sized avatar

Günay Mert Karadoğan gmertk

View GitHub Profile
@gmertk
gmertk / cheatsheet.sol
Created November 30, 2021 22:05 — forked from patrickd-/cheatsheet.md
Solidity – Compilable Cheatsheet
// SPDX-License-Identifier: MIT
// ^ recommended, included machine readable in bytecode metadata
// Software Package Data Exchange is an open standard
pragma solidity ^0.8.7;
// ^ floating pragma, min 0.8.7 max excluding 0.9.0
// same as complex pragma: pragma solidity >=0.8.7 <0.9.0;
// major.breakingchanges.bugfixes
// only makes the compiler check for compatibility and throws error if not matching!
// should only be floating during development, fixed everywhere during testing & deployment
import Foundation
func main() {
print("Starting")
// GCD works by dispatching chunks of code (represented by closures, and called 'blocks') onto things called 'dispatch
// queues'. These queues run the blocks, either on the main thread or in a background thread. (Queues don't correspond
// to threads on a one-to-one basis; GCD is responsible for spinning up threads to service queues.)
// Here's a variable representing shared state I want to manipulate from different threads.
@gmertk
gmertk / Selenium Cheat Sheet.md
Last active January 8, 2019 16:11 — forked from kenrett/Selenium Cheat Sheet.md
Selenium Cheat Sheet - Ruby

#Getting Started

##Webpage:

<html>
<head>
    <title>Testing with Ruby and Selenium WebDriver</title>
</head>
 
<body bgcolor="antiquewhite">
@gmertk
gmertk / selenium-webdriver-cheatsheet.md
Last active September 13, 2015 11:20 — forked from huangzhichong/selenium-webdriver-cheatsheet.md
Selenium Webdriver CheatSheet

API workthough

  1. Open a browser

    # start an instance of firefox with selenium-webdriver
    driver = Selenium::WebDriver.for :firefox
    # :chrome -> chrome
    # :ie     -> iexplore
    
  • Go to a specified URL
var x: Int? = 0
// Lets me unwrap x and also check a condition on it
func fooGuard() {
guard let x = x where x > 0 else {
return
}
// Do stuff with x
x.value

Whether you use 2 spaces or 4 spaces, there are a few simple things that can make your node.js code easier to read. We've been using them in all the hapi modules for over 4 years now to great results. This list is by no means complete but it highlights the most useful elements that will give you immediate value in reducing bugs.

Required modules

JavaScript makes it harder than most languages to know where variables are coming from. Variables assigned required modules are particularly important because they represent a singleton object shared with the entire application. There are also globals and module globals, along with function variables and arguments.

Traditionally, variables starting with an uppercase letter represent a class that must be instantiated using new. This was an important semantic in the early days of JavaScript but at this point, if you don't know Date requires new Date() you are probably very new. We have adopted Upper Camel Case variable names for all module global variables

@gmertk
gmertk / 0_reuse_code.js
Created January 16, 2014 10:23
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

Launch Sublime Text 2 from the Mac OS X Terminal

Sublime Text 2 ships with a CLI called subl (why not "sublime", go figure). This utility is hidden in the following folder (assuming you installed Sublime in /Applications like normal folk. If this following line opens Sublime Text for you, then bingo, you're ready.

open /Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl

You can find more (official) details about subl here: http://www.sublimetext.com/docs/2/osx_command_line.html

Installation