Skip to content

Instantly share code, notes, and snippets.

View inez's full-sized avatar
💭
Migrating...

Inez Korczyński inez

💭
Migrating...
View GitHub Profile
require "net/http"
require "websocket"
store = OpenSSL::X509::Store.new
store.set_default_paths
ctx = OpenSSL::SSL::SSLContext.new(:TLSv1_2_client)
ctx.set_params(verify_mode: OpenSSL::SSL::VERIFY_PEER)
ctx.cert_store = store
sock = OpenSSL::SSL::SSLSocket.open(
# brew install fzf
# brew install yq
# Add below line to `~/.aliases`
alias pick_targets="cat kochiku.yml | yq e '.targets[].type' - | fzf -m | tr '\n' ',' | sed 's/,$/\n/'"
@inez
inez / test
Created January 26, 2021 22:48
test12
@inez
inez / test
Created January 26, 2021 22:48
test
(function(API){
API.myText = function(txt, options, x, y) {
options = options ||{};
/* Use the options align property to specify desired text alignment
* Param x will be ignored if desired text alignment is 'center'.
* Usage of options can easily extend the function to apply different text
* styles and sizes
*/
if( options.align == "center" ){
// Get current font size
@inez
inez / controllers.application.js
Last active November 14, 2018 01:00
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
lineItems: [],
init() {
this._super(...arguments);
this.lineItems.push(11);
this.lineItems.push(22);
this.lineItems.push(33);
@inez
inez / controllers.application.js
Created November 12, 2018 19:13
readonly and mut
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
ourValue: 1,
actions: {
increse: function() {
this.set('ourValue', 1 + Math.abs(this.get('ourValue')));
},
onkeyup: function(e) {
@inez
inez / components.step-1.js
Created August 7, 2018 23:59
playing with actions
import Ember from 'ember';
export default Ember.Component.extend({
actions: {
YES() {
this.sendAction('YES');
},
NO() {
this.sendAction('NO');
},
<?php
$txtOrig = $txt = file_get_contents('bad.txt');
function test($str) {
preg_replace_callback("/test/u", function($matches) { return ''; }, $str);
return preg_last_error() === 4 /* PREG_BAD_UTF8_ERROR */;
}
$i = 0;
@inez
inez / gist:6fd0049739261f9877a4
Created December 4, 2015 21:37
Generate image with similar colors
package colors;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import javax.imageio.ImageIO;