Skip to content

Instantly share code, notes, and snippets.

View joladev's full-sized avatar

Johanna Larsson joladev

View GitHub Profile
@joladev
joladev / defer.js
Last active December 21, 2015 03:19
var defer = function () {
var value,
resolution,
handlers = {};
var fulfill = function () {
if (resolution) {
var handler = handlers[resolution];
if (handler) {
handler();
REM Install Chocolatey
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin
REM Install Tools
cinst Firefox &&
cinst firefoxaurora &&
cinst ulsviewer &&
cinst GoogleChrome &&
cinst GoogleChrome.Canary &&
cinst opera &&
var intervalId = setInterval(function () {
if (condition) {
return;
} else {
clearInterval(intervalId);
}
alert("I finished");
@joladev
joladev / gist:5933011
Last active December 19, 2015 09:29 — forked from anonymous/gist:5933010
public int LostTrainees(int a, int b, int c)
{
int lives = 3;
int doorsOpened = 0;
while (true)
{
var result = OpenDoor(b);
var weapon = GetWeapon();
switch (result)
{
@joladev
joladev / insertjquery.js
Created June 28, 2013 14:43
Insert jQuery into current page
// Insert jQuery into current page
var s = document.createElement("script");
s.src = "//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js";
document.getElementsByTagName("head")[0].appendChild(s);
// class definition
public class JavaClass {
// this is a field, also known as class variable
private String variableName;
// they can also be public, but this is not recommended!
public String badVariable;
// you can initialize the value in the same step
CUSTOM_CSS_PATH="/Users/$(whoami)/Library/Application Support/Google/Chrome/Default/User StyleSheets/Custom.css"
CUSTOM_CSS="body { -webkit-transform: rotate(180deg); }"
if [ "$1" = "--undo" ]
then
mv "$CUSTOM_CSS_PATH.backup" "$CUSTOM_CSS_PATH"
else
cp "$CUSTOM_CSS_PATH" "$CUSTOM_CSS_PATH.backup"
echo $CUSTOM_CSS >> "$CUSTOM_CSS_PATH"
fi
function april {
param([Switch] $Undo)
$customCssPath = "C:/Users/$env:username/AppData/Local/Google/Chrome/User Data/Default/User StyleSheets/Custom.css"
$customCss = "body { -webkit-transform: rotate(180deg); }"
if ($Undo)
{
copy "$customCssPath.backup" $customCssPath
}
@joladev
joladev / NewInheritance.cs
Last active December 15, 2015 07:09
Inheritance and new keyword
using System;
class Program
{
public class A
{
public void print()
{
Console.WriteLine("A");
}
}