Skip to content

Instantly share code, notes, and snippets.

Yehonatan Levi leviyehonatan

Block or report user

Report or block leviyehonatan

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Service.js
import React, { useState } from 'react';
import { Form, Header, Segment, Dropdown, Label, Button } from 'semantic-ui-react';
import { Query, Mutation } from 'react-apollo';
import gql from 'graphql-tag';
import MembersSelectionBox from './MembersSelectionBox';
export default ({ id, onSaved }) => {
const [name, setName] = useState();
return (
<Segment>
View docker-compose.yml
version: "3"
services:
server:
image: node:8
volumes:
- ./:/app
working_dir: /app
depends_on:
- mongo
environment:
@leviyehonatan
leviyehonatan / app_v2.js
Last active Jan 29, 2019
my problem with flatlist overflow
View app_v2.js
import {Animated, Dimensions, NativeModules, Platform, StyleSheet} from 'react-native';
import {formStyle} from './forms';
import {FEED} from './app';
import DeviceInfo from 'react-native-device-info';
import * as config from '../config';
const { StatusBarManager } = NativeModules;
const WIDTH = Dimensions.get('window').width;
const HEIGHT = Dimensions.get('window').height;
View Alarm.kt
fun setExactAlarm(type: Int, triggerAtMillis: Long, operation: PendingIntent ) {
if (Build.VERSION.SDK_INT >= 23)
alarmManager.setExactAndAllowWhileIdle(type, triggerAtMillis, operation)
else if (Build.VERSION.SDK_INT >= 19)
alarmManager.setExact(type, triggerAtMillis, operation)
else
alarmManager.set(type, triggerAtMillis, operation)
}
setExactAlarm(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + (1000 * notification.active_after),
@leviyehonatan
leviyehonatan / PersistentCookieStore.kt
Last active May 23, 2016
This is a kotlin implementation of a persistent cookie store for android, using SharedPreferences and Gson for the actual persistence
View PersistentCookieStore.kt
internal class PersistentCookieStore(val context: Context) : CookieStore {
inner class DatedCookie(val cookie: HttpCookie, val creationDate: Date)
val SP_COOKIE_STORE = "cookieStore"
val SP_KEY_DELIMITER = "|"
val SP_KEY_DELIMITER_REGEX = "\\" + SP_KEY_DELIMITER
val cookieSharedPreferences = context.getSharedPreferences(SP_COOKIE_STORE, Context.MODE_PRIVATE)
@leviyehonatan
leviyehonatan / AndroidManifests.xml
Last active Feb 17, 2016
a reproduction of a scenario which produces a problem with robolectric ShadowBroadcastReceiver
View AndroidManifests.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test">
<application android:allowBackup="true" android:label="@string/app_name">
<receiver android:name=".Receiver" >
<intent-filter>
<action android:name="com.test.message" />
</intent-filter>
</receiver>
@leviyehonatan
leviyehonatan / somecode.swift
Created Jun 15, 2015
reading and writing to my logfile
View somecode.swift
func existingLog() -> String? {
if let logFileHandle = NSFileHandle(forReadingAtPath: logFile) {
let data = logFileHandle.readDataToEndOfFile()
return NSString(data:data, encoding:NSUTF8StringEncoding) as String?
}
return nil
}
func log(log: String) {
let logLine = "\(NSDate()) \(log)\n"
@leviyehonatan
leviyehonatan / LoginInfo.java
Last active Aug 29, 2015
gson serialization yields null
View LoginInfo.java
package test;
import java.util.List;
public class LoginInfo {
public class DeviceInfo {
public String deviceId;
public String deviceType;
public String deviceOs;
public int deviceVersion;
@leviyehonatan
leviyehonatan / logger.py
Last active Aug 29, 2015
some location logger
View logger.py
import pymongo
import json
import os
from datetime import datetime
from itertools import chain
from pprint import pprint
from flask import Flask, session, request, abort, make_response
app = Flask(__name__)
View deafult.html.jade
nav
ul
each doc in getCollection('documents').findAll({nav : { $exists : true}}).toJSON()
li
a(href=doc.url)
!= doc.nav
You can’t perform that action at this time.