Skip to content

Instantly share code, notes, and snippets.

@Deiru2k
Deiru2k / ajax-select.html
Created November 23, 2015 14:03
Ajax select in angular.js using ui-select
<div class="row search-select-group">
<div class="search-select"
ng-class="{'col-xs-12': !ajs.allowClear, 'col-xs-11': ajs.allowClear}">
<ui-select ng-model="ajs.model" append-to-body="true">
<ui-select-match allow-clear="ajs.allowClear"
placeholder="{{ajs.placeholder}}">
{{$select.selected[ajs.displayField]}}
</ui-select-match>
<ui-select-choices
repeat="objs[ajs.modelField] as obj in ajs.lookup | filter: $select.search"
@Deiru2k
Deiru2k / example.js
Created November 24, 2015 12:18
StringReplace
{ test: /\/src\/api.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /@apiUrl@/ig,
replacement: function (match, p1, offset, string) {
return myUrls[process.env.NODE_ENV];
}
}
]})
}
def myFunc(arg1, arg2):
result = arg1 + arg2
return result
print(myFunc(2, 3))
class Login extends Component {
constructor() {
super();
this.changeField = this.changeField.bind(this);
this.login = this.login.bind(this);
this.state = {
login: ``,
password: ``,
// Place your settings in this file to overwrite the default settings
{
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe",
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.detectIndentation": false,
"files.trimTrailingWhitespace": true,
"editor.rulers": [100]
}
@Deiru2k
Deiru2k / Root.jsx
Created August 26, 2016 15:03
Footer / Header
import React from 'react';
import MyFooter from 'components/MyFooter';
export default ({ children }) => (
<section>
{this.props.children}
<MyFooter />
</section>
)

TWITCH

  • Add and remove things that are Twitch.tv related.
  • Notes: To add game filters and title filters, you MUST include the brackets. Do NOT use the full Twitch URL. It will not work!! Use only the channel name (www.twitch.tv/channelName) The Team name must be from the URL, not the display name of the team. (www.twitch.tv/team/teamName) You may add multiple channels, teams, games, communities, game and title filters by using the pipe character | between them. The only required options are: channelName/communityName/teamName/gameName

Twitch Channels

<div>
<input [(ngModel)]="value" />
<button type="button" (click)="addValue(value)">Add</button>
</div>
<div>
{'wew lad'.split(' ').map(e => e === 'lad' ? <span>{e}&nbsp;</span> : `${e} `)}
</div>
@Deiru2k
Deiru2k / fetcher.tsx
Created October 6, 2017 15:55
GENERICS, BRUH.
import * as React from 'react';
import * as Bluebird from 'bluebird';
import * as superagent from 'superagent';
type dataMapFN<T> = (originalData: any) => T;
type combineDataFN<T> = (oldData: T, newData: any) => T;
export interface FetcherPropGeneric<T> {
data?: T,
isLoading: boolean,