Skip to content

Instantly share code, notes, and snippets.

View 2J's full-sized avatar
🍗
🍗

Justin 2J

🍗
🍗
View GitHub Profile
@2J
2J / gist:72823b89330f5d3ea811
Created May 28, 2014 18:05
Dynamic Array C++
//dynamic array
int n;
//get n from user
int* array;
array = new int[n];
//do things
<?php
// create curl resource
$ch = curl_init();
// set url
curl_setopt($ch, CURLOPT_URL, "google.com");
//return the transfer as a string
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
@2J
2J / gist:e6243e5941e9ae7f5e0f
Created August 6, 2015 02:29
cowsep chest opening script
$('#tab_c > div.inventory > .inventory-slot').each(function(index,item){
if($(item).children('.inventory-item').data('item-type') == 'chest'){
$.get( "crates.php", {crate: $(item).children('.inventory-item').data('item-id')});
};
});
alert('opening chests...');
@2J
2J / example.html
Last active March 8, 2021 10:54
Angular 2 tabs example
<tabs>
<tab tabTitle="Tab 1">Tab 1 Content</tab>
<tab tabTitle="Tab 2" [active]="true">Tab 2 Content</tab>
<tab tabTitle="Tab 3" [disabled]="true">Tab 3 Content</tab>
<tab tabTitle="Link Tab 4" href="http://google.com">Link Tab</tab>
<tab tabTitle="Link Tab 5" href="http://google.com" [disabled]="true">Disabled Link Tab</tab>
</tabs>
@2J
2J / off-click.directive.ts
Created November 7, 2016 21:33
Angular 2 directive with event that fires when user clicks outside of element
import { Directive, HostListener, Output, OnInit, OnDestroy, ElementRef, EventEmitter } from '@angular/core';
@Directive({
selector: '[offClick]'
})
export class OffClickDirective implements OnInit, OnDestroy {
@Output('offClick') public offClick: EventEmitter<null> = new EventEmitter<null>();
constructor(
@2J
2J / off-click.directive.ts
Created November 10, 2016 21:04
Angular 2 search-field with autocomplete
import { Directive, HostListener, Output, OnInit, OnDestroy, ElementRef, EventEmitter } from '@angular/core';
@Directive({
selector: '[offClick]'
})
export class OffClickDirective implements OnInit, OnDestroy {
@Output('offClick') public offClick: EventEmitter<null> = new EventEmitter<null>();
constructor(
@2J
2J / README.md
Last active November 25, 2016 20:34
Cachebuster for Angular2 html/css files

Cachebuster for html/css files in Angular2

Use a settings file to get the environment/version # in cachebuster loader