Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false"
android:color="@color/flat_disabled_text"/>
<item android:color="@color/flat_normal_text"/>
</selector>
@neutronstein
neutronstein / share_text_attach_ace.js
Last active April 23, 2016 03:59 — forked from geakstr/share_text_attach_ace.js
Ace editor (v1.2.3) and ShareJS (v0.7.40) text adapter
function attachAce(editor, doc) {
if (!doc.provides.text) {
throw new Error("Cannot attach ace to non-text share document");
}
let suppress = false;
editor.setValue(doc.getSnapshot() || "");
check();
const newline = editor.session.getDocument().getNewLineCharacter();
sudo yum install -y pam-devel
sudo yum install -y rpm-build
sudo yum install -y zlib-devel
mkdir -p ~/rpmbuild/SOURCES
cd ~/rpmbuild/SOURCES
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz
wget -c http://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.7p1.tar.gz.asc
# verify the file
# update the pam ssd from the one included on the system
@neutronstein
neutronstein / sse.go
Created April 6, 2019 11:00 — forked from ismasan/sse.go
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
func openbrowser(url string) {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin":
err = exec.Command("open", url).Start()
@neutronstein
neutronstein / repo.ex
Created January 15, 2020 11:15 — forked from teamon/repo.ex
defmodule Recruitee.Repo do
use Ecto.Repo, otp_app: :recruitee
import Ecto.Query
@doc """
Stream query results
Example:
iex> Candidate
...> |> where([c], c.foo > 4)
@neutronstein
neutronstein / main.dart
Last active May 11, 2020 10:57 — forked from collinjackson/main.dart
PageView example with dots indicator
// Copyright 2017, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
@neutronstein
neutronstein / HasWhereNotTrait.php
Created July 31, 2020 21:17 — forked from waska14/HasWhereNotTrait.php
app/Traits/HasWhereNotTrait.php
<?php
namespace App\Traits;
use Closure;
use Illuminate\Database\Eloquent\Builder;
trait HasWhereNotTrait
{
/**
@neutronstein
neutronstein / pause_resume.go
Created December 19, 2020 16:44 — forked from ik5/pause_resume.go
Example on pause and resume threads in golang
package main
import (
"fmt"
"runtime"
"time"
)
// Thread stages
const (
@neutronstein
neutronstein / flag.php
Created February 14, 2024 11:12 — forked from IonBazan/flag.php
Country code to country flag Emoji (PL -> 🇵🇱)
<?php
/**
* Converts country code (ISO 3166-1) to its emoji flag representation (PL -> 🇵🇱).
*
* This solution supports both lowercase and uppercase codes using modulo 32 .
* Since it doesn't perform any validation, you should make sure the code is a valid country code first.
*
* 0x1F1E5 is a code of character right before "REGIONAL INDICATOR SYMBOL LETTER A" (🇦).
*